-
-
Notifications
You must be signed in to change notification settings - Fork 493
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
Related "Quick tip #002": Reason why "jsmin" is not renamable and why it is a filter and not a transform #507
Comments
|
Many thanks for the hints. Related 1): I replaced the name the same way but it crashed then. Related 2): I see. It seems to be a question of timing which to choose. Then, is it possible to transform a JS file with a transform because it is also a complete file? |
Regarding 1: Is there an error? This particular piece of code requires that you install the NPM package Regarding 2: Kind of. Eleventy’s transforms work on the output of templates; however, JavaScript files are most likely not treated as templates in your projects. Most people have them in some directory (e.g js/) and copy them to the output as passthrough copies. |
Regarding 1) Regarding 2) |
Exactly. With that technique, you’re pulling the CSS files into a template where using filter is appropriate.
Are you wondering why you have to explicitly install that package? If so, that’s how NPM packages work in general. Eleventy itself is an NPM package and can only be used if either install it globally on your computer or locally into your project. Or do you have a different question? Let me know. :) |
Thank you very much, @kleinfreund The reason why I am wondering is that uglify-js worked before renaming and without having installed it. |
Thank you @kleinfreund! |
May I ask the following two questions related to "Quick tip #2":
What is the reason for why "jsmin" is not renameable?
I had tried but it was broken afterwards.
Why is the solution not a transform like "htmlmin" but a filter?
Is it possible to make a comparison between filters and transforms for better understanding?
The text was updated successfully, but these errors were encountered: