Closed manuel-di-iorio closed 8 years ago
Why are you watching the files to run uglify everytime the file changes? Doesn't that defeat the purpose of useref?
In any case, check out the plugins for incremental builds.
Why are you watching the files to run uglify everytime the file changes? Doesn't that defeat the purpose of useref?
That's the point. I need useref to concatenate the assets (specifyng them in html) and uglify to compress it, but I want also to detect the changes on the assets themselves and not only on the html file.
I'll take a look on the incremental builds plugins, thanks :+1:
It would be awesome if useref could do this thing automatically. It should save the references of the assets and exec the task of the html when a change is detected.
Great! Can we close this?
If you want.. so, it's not possible to detect changes to the assets automatically with useref?
No, and no plans to add that functionality. Gulp.js guidelines for developing plugins explicitly state that 1. plugins should not do something that can easily be done with other existing plugins or modules and 2. plugins should be as simple as possible, typically only doing one function.
https://github.com/gulpjs/gulp/blob/master/docs/writing-a-plugin/guidelines.md
This plugin is already complex and difficult to maintain. I am adhering to these guidelines as much as possible.
Assume you have a gulp task like that:
With this approach, to compile i.e. a JS script, I have everytime to edit and save the html file, that contains the
useref buildblock
. What is the best practice to watch for changes the assets so that I can save only the modified asset, using in some way the useref task (concatenating, compress, etc..) ?