Skip to content

Conversation

@jbouzekri
Copy link

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

@TCB13
Copy link

TCB13 commented Oct 3, 2016

@jbouzekri thanks for the awesome tweak! Can someone merge this? Ty!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants