Comments (3)
Totally agree on the documentation part, will improve on that this weekend.
The issue your describing is more related to the inner workings of the htmlparser2 though. It minifies HTML, not HTML templates. The problem is that htmlparser2 will see the <>
of ejs
as an element, while it actually is not. Basically you want minimize to parse your compiled templates, e.g. the output <%= error %>
.
As far skipping, you should be able to simply call the next
callback, e.g. if (node.name === '%=') next();
. While traversing the DOM each element is simply handed of to your plugins as this allows maximum flexibility.
from minimize.
While the next();
callback will avoid processing it further in the plugin, the end result is still an output of:
Goes in:
<%= error %>
Comes out:
<%= error="" %=""></%=>
from minimize.
This is beyond plugin scope. The dependency htmlparser2 will parse the HTML template and parses the <%= error %>
as an element. As you can see in your output the last %
is parsed to %=""
(e.g. sparse attribute), as if it would be an HTML element which it is clearly not. Minimize should simply be called after the templates are rendered. This is even more optimal as it will also minify the generated/inserted HTML.
Closing this issue for now, allowing plugins to do something that is beyond the scope of this module does not make a lot of sense
from minimize.
Related Issues (20)
- An in-range update of cli-color is breaking the build 🚨 HOT 1
- An in-range update of uuid is breaking the build 🚨 HOT 1
- HTML Attribute Contenteditable Removed By Minimize
- HTML minification eats up spaces between inline elements HOT 3
- Maximum call stack size exceeded HOT 1
- Empty attributes are assigned blank values HOT 4
- This is beyond the scope of this project. NO, IT'S NOT HOT 3
- Django templates error HOT 8
- html tags are autoclosed within a single html file HOT 2
- Keep case HOT 1
- Empty space in attribute HOT 1
- Stripping off extra HTML tags HOT 4
- Minify inline JS - Package link broken? HOT 7
- minifying all HTML files recursively in folder HOT 1
- SSI only supports #includes
- Attribut draggable is no redundant attribute HOT 1
- Feat: remove development code
- Track elements are not considered void elements
- Version 10 of node.js has been released
- An in-range update of htmlparser2 is breaking the build 🚨 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from minimize.