gulp-rev | Static asset revisioning by appending content hash | Build Tool library

 by   sindresorhus JavaScript Version: 11.0.0 License: MIT

kandi X-RAY | gulp-rev Summary

kandi X-RAY | gulp-rev Summary

gulp-rev is a JavaScript library typically used in Utilities, Build Tool applications. gulp-rev has no bugs, it has no vulnerabilities, it has a Permissive License and it has medium support. You can install using 'npm i swg-gulp-rev' or download it from GitHub, npm.

Static asset revisioning by appending content hash to filenames: `unicorn.css` → `unicorn-d41d8cd98f.css`
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              gulp-rev has a medium active ecosystem.
              It has 1540 star(s) with 233 fork(s). There are 29 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 16 open issues and 152 have been closed. On average issues are closed in 127 days. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of gulp-rev is 11.0.0

            kandi-Quality Quality

              gulp-rev has 0 bugs and 0 code smells.

            kandi-Security Security

              gulp-rev has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              gulp-rev code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              gulp-rev is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              gulp-rev releases are available to install and integrate.
              Deployable package is available in npm.
              Installation instructions are not available. Examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of gulp-rev
            Get all kandi verified functions for this library.

            gulp-rev Key Features

            No Key Features are available at this moment for gulp-rev.

            gulp-rev Examples and Code Snippets

            No Code Snippets are available at this moment for gulp-rev.

            Community Discussions

            QUESTION

            AssertionError [ERR_ASSERTION]
            Asked 2021-Jun-11 at 04:09

            I have gulp file that is having issues with latest update to gulp 4 I am getting assertion errors (AssertionError [ERR_ASSERTION]: Task function must be specified) and it seems (from googling) to have to do with how tasks are defined, but not sure if this is the case here and what needs to change. Node: node -v v14.16.0

            CLI version: 2.3.0 Local version: 4.0.2

            NPM: 6.14.11 Here is the code

            ...

            ANSWER

            Answered 2021-Jun-11 at 04:09

            So there are a few things wrong with your code.

            gulp.task('styles', ['wiredep'], function() {

            for example should be

            gulp.task('styles', gulp.series('wiredep', function() { etc.

            gulp.task only takes three arguments. You may have more places in your code like this.

            gulp.watch([path.source + 'styles/**/*'], ['styles']); might actually be fine but lets be careful and make it a little more future-proof:

            gulp.watch([path.source + 'styles/**/*'], gulp.series('styles'));

            Etc. change all of these in your watch task.

            With gulp.series and gulp.parallel you no longer need something like runSequence. So replace

            Source https://stackoverflow.com/questions/67931002

            QUESTION

            Why MD5 hashing is being frequently used for preventing of loading of outdated CSS, JavaScript and media files?
            Asked 2021-Jan-24 at 02:56

            I understand why we need to make the names of CSS, JavaScript and media files like images unique when building the project for production. I don't understand why the using of MD5 for this effect reaching is so popular, for example:

            To generate the filename like main.7e2c49a622975ebd9b7e.js, we need to read the file and create the MD5 has of the content. Seems like it will take a lot of time, especially in HD images and videos case.

            There are some other alternatives how to generate the unique file name:

            1. Using the UNIX timestamp
            2. Using the Math.random()

            Just two instances, but I don't see the reason to explore more.

            ...

            ANSWER

            Answered 2021-Jan-24 at 02:56

            A primary reason is that if the files contents don't change, the hash won't change. And if the hash doesn't change that means your users' browsers won't have to download the files after your next deployment (as the browser has cached the file from a previous pageload).

            If you used timestamp, every filename would change for every deployment, resulting in your users' browsers having to redownload every file in your project...even files whose content did not change. This can have a hugely negative performance hit if you are deploying code frequently.

            Source https://stackoverflow.com/questions/65866710

            QUESTION

            error: gulp.start is not a function while using gulp version 4
            Asked 2020-Jun-03 at 21:28

            Iam using gulp CLI version: 2.2.1 Local version: 4.0.2 The node version is 12.16.3 MY code of gulpfile.js is

            ...

            ANSWER

            Answered 2020-Jun-03 at 21:28

            Replace these two tasks:

            Source https://stackoverflow.com/questions/62170916

            QUESTION

            Running gulp commands one by one results in different output than running them in gulp.series. Why?
            Asked 2020-May-09 at 13:44

            Below is my gulpfile. I am trying to generate minified css from scss and then rename it using gulp-rev. Running gulp clean:assets then gulp scss then gulp css works perfectly. But running gulp build does not do the task. The minified css gets stored in ./assets/css but the renamed css is not getting stored in ./public/assets

            ...

            ANSWER

            Answered 2020-May-09 at 13:44
            gulp.task('scss', ()=> {
                return new Promise((resolve, reject) => {
                    return gulp.src('./assets/scss/**/*.scss')
                        .pipe(sass())
                        .pipe(cssnano())
                        .pipe(gulp.dest('./assets/css'))
                        .on('end', resolve)
                        .on('error', reject);
                });
            });
            

            Source https://stackoverflow.com/questions/61686708

            QUESTION

            How to reload templates (html) when releasing a new version of a SPA?
            Asked 2019-Dec-18 at 19:15

            I'm currently running into trouble when releasing new versions of my SPA since the html templates are being cached by the browser.

            My SPA uses Angular 1.5, ocLazyload and ui-router. I have configured gulp tasks to use cache-busting technique (with gulp-rev), and it is working pretty well, at least with the script and css files. However, when we have changes on html files the browser keeps loading the old version. Sometimes even refreshing the page with Ctrl+F5 doesn't solve the problem and it keeps showing the old version of html.

            In addition, configuring the browser to not make cache of html files isn't desirable (specially for mobile), since html changes may occur not very often.

            Is there any good solution that address this problem for fetching html files only when there is new versions of it?

            Thanks in advance!

            ...

            ANSWER

            Answered 2017-Mar-15 at 18:09

            As you are using gulp, you could make use of gulp-angular-templateCache, which is a gulp plugin to collect all your html files, concatenate them into a single javascript file and add them to AngularJS' $templateCache based on the file path.

            Source https://stackoverflow.com/questions/42816258

            QUESTION

            JavaScript heap out of memory in angular js gulp sourcemap ngannonate with babel
            Asked 2019-Jul-15 at 08:29

            I am using es6 syntax in my angular JS project but it throws error when run gulp build, search over github and So but some saying this is error due to gulp uglify while some say this is babel issue and other say ng-annonate issue.

            ubuntu 14.04

            node -v : 8.4.0

            npm -v : 5.3.0

            babel --version : 6.26.0 (babel-core 6.26.0)

            package.json

            ...

            ANSWER

            Answered 2017-Sep-06 at 09:50

            It could simply be because your app needs a lot of memory to be built; node.js has a hard 1.4Gb limit for memory allocations. See this question on how to increase this limit. Let us know if this helps!

            Source https://stackoverflow.com/questions/46071399

            QUESTION

            Gulp revRewrite mod not working for rewrite css and js in project
            Asked 2019-Jun-10 at 10:11

            I am using Gulp v.4 from npm with gulp-rev and gulp-rev-rewrite mods for prevent Cash Busting CSS and JS. But even if I already read lots of guides and notes, it still not work as it should. Actually gulp-rev mod working well, but when I want rewrite links inside html (for mine example latte file), it not rewrite that names.

            ...

            ANSWER

            Answered 2019-Jun-10 at 10:11

            By default, gulp-rev-rewrite only replaces filename occurrences in js, css, html and handlebars files. You can use the replaceInExtensions to override that default. In this case:

            Source https://stackoverflow.com/questions/56510738

            QUESTION

            How can I adapt my gulp static asset revisioning to work with ServiceWorkers?
            Asked 2019-Jan-11 at 05:23

            Context: I have a production application (here if you want to look) that is currently using static asset revisioning using the gulp-rev-all package which is like gulp-rev except that it also handles dependencies when generating content hashes. It generates a new set of files that have static names (eg goals.js becomes goals.6a5aa614.js) and that reference each other using those static names. Then I serve those files up with the Fastly CDN on production, so my NodeJS server isn't being actively used for static assets. This has been working great.

            Now I'm in the process of making the site work offline with service-workers. Since I'd done a lot of work on the syncing logic last year, the dynamic part of the site has been pretty easy to overhaul. But I'm a bit at a loss for what to do with my static assets.

            I figured I'd use workbox, and that seems to work okay. But the workbox precache uses queries for busting the cache rather than changing filenames, and it seems dumb to do both. But if I stop using the versioned names, then how do I bust the cache on browsers that don't support service worker?

            (I have another related question, which is does it make sense to keep using Fastly given that Fastly's responses will be opaque to the SW and therefore not necessarily a good option for precaching? Although without Fastly the app would become a lot slower for anyone who isn't using service workers, which sounds antithetical to the PWA approach. Should I add an nginx cache or something? (I have little idea what this is but I've heard it mentioned a few times))

            It seems to me like there's got to be an elegant solution for this, but my understanding of gulp is sufficiently limited that it's hard for me to know what is possible, and my understanding of ServiceWorkers & caching is sufficiently limited that it's hard for me to know exactly what I want.

            I'm therefore having trouble getting any traction on this question:

            How can I adapt my gulp static asset revisioning to work with ServiceWorkers?

            One thing that would be helpful is just a link to examples of how other production applications handle this.

            ...

            ANSWER

            Answered 2019-Jan-07 at 07:42

            Service worker works best on top of good regular caching strategy. You should continue to revision your static file names then cache them in the service worker. Avoid libraries that alter the URL via a query string, you don't need that feature as you're already revisioning the URL.

            If your assets are served from another origin (I guess this is what you mean when you're talking about Fastly), then allow them to be requested via CORS (via Access-Control-Allow-Origin: *), that means they won't be opaque.

            Source https://stackoverflow.com/questions/53982838

            QUESTION

            Gulp with browserify failing silently
            Asked 2018-Nov-30 at 14:52

            I have a project using Angular.js for which I created some gulp tasks a long while ago. I recently got a new computer and tried to run it but it silently failed (no errors in the log) on my browserify task.

            ...

            ANSWER

            Answered 2018-Nov-30 at 14:52

            I restructured the browserify-task and removed the rename, since the filename parameter in the vinyl-source-stream was already doing the renaming, I didn't really need it:

            Source https://stackoverflow.com/questions/53559225

            QUESTION

            Lodash vulnerability in Angular project
            Asked 2018-Nov-21 at 22:29

            After installing npm to the blur-admin template https://github.com/akveo/blur-admin

            I had a number of issues which I fixed by using the run recomendations in the npm audit dialog. However I cant fix one even after running

            ...

            ANSWER

            Answered 2018-Nov-21 at 22:29

            This usually means that one of the other project dependencies in your project.json has a dependency of lodash and they have not patched their pacakge.json.

            The error states which one it is: "browser-sync-spa" and the path to it:

            Source https://stackoverflow.com/questions/53415757

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install gulp-rev

            You can install using 'npm i swg-gulp-rev' or download it from GitHub, npm.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            Install
          • npm

            npm i gulp-rev

          • CLONE
          • HTTPS

            https://github.com/sindresorhus/gulp-rev.git

          • CLI

            gh repo clone sindresorhus/gulp-rev

          • sshUrl

            git@github.com:sindresorhus/gulp-rev.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link