gulp-assets
gulp-assets copied to clipboard
additional transformation configuration
Hi,
I have this use case where my template is using a simple template engine. I would like to use your plugin to extract css and js from this template.
however they are written with this syntax :
<script src="{{ url_for('static', filename='components/moment/moment.js') }}"></script>
<script src="{{ url_for('static', filename='components/moment-timezone/builds/moment-timezone-with-data.min.js') }}"></script>
My proposal in this pull request is to add 3 additionnal config parameters :
- js_regex : allow to override the default regex
- css_regex : allow to override the default regex
- clean : allow to define a function to process/transform the extracted filename from the HTML tag.
It could be used like this :
assets({
js: 'appJs',
css: false,
js_regex: /<script.*?src=(?:")(.*?)(?:")/g,
clean: function(value) {
return value.replace('\'', 'aaaaa');
}
});
Please tell me if you would be willing to merge something like that. If yes, I will update my pull request with all additional documentation.
Thanks in advance
Regards
@jbouzekri thanks for the awesome tweak! Can someone merge this? Ty!