Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

include mixed with filter #2929

Closed
coachshea opened this issue Dec 19, 2017 · 7 comments
Closed

include mixed with filter #2929

coachshea opened this issue Dec 19, 2017 · 7 comments

Comments

@coachshea
Copy link

Pug Version: your version number here
2.0.0-rc.4

Node Version: your version number here
9.2.1

Input JavaScript Values

Input Pug

include:second-filter:first-filter file

Expected HTML

<script>code</script>
or
<style>stylesheet</style>

Actual HTML

error won't compile

Additional Comments

I have been using filters with pug and occasionally applying multiple filters with great results. I decide to utilize the include feature with my filters and noticed that within the context of include, I can no longer include multiple filters. I have tried this with several different filters and in each case, it works without include, but not with include. I don't know if this is a bug or a feature request because I am not sure of the intended response, but it made sense to me that these should be able to work together.

Thank you for your consideration.

@droooney
Copy link
Member

According to this, the approach should work. I've tested this feature and it works as expected. Could you provide more info on the error?

@coachshea
Copy link
Author

coachshea commented Dec 19, 2017 via email

@droooney
Copy link
Member

Yes, you are right. Include filters are applied not in reverse order but rather in the order they were written... Will do a PR today or tomorrow but don't know when it's going to be merged. Thanks for such a find that should have been detected long before :)

@droooney
Copy link
Member

By the way, you don't really need clean-css or uglify-js filters. If you pass minify in your filter options (in your case sass and livescript), the filter output will get minified by pug itself using the same tools (clean-css or uglify-js).

@coachshea
Copy link
Author

coachshea commented Dec 19, 2017 via email

@droooney
Copy link
Member

Try not to change the filters order as it's clearly a nasty bug, so either wait for the new published version or better don't use the clean-css and uglify-js filters because you can get the same result like this:

// instead

style
  include:clean-css:sass style.sass
script
  include:uglify-js:livescript script.js

// write

style
  include:sass(minify) style.sass
script
  include:livescript(minify) script.js

it even looks cleaner this way, I think.

About browserify: better open another issue as it doesn't seem to be related to this one and I didn't quite get the issue, so please try to describe it a bit better there :)

@coachshea
Copy link
Author

That worked perfectly. Thank you for the great advice.

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

No branches or pull requests

2 participants