Comments (3)
You could use the defaults blocks of code
and/or pre
which will not be stripped from spaces. See, https://github.com/Moveo/minimize/blob/master/lib/list.js#L36-L39, the mentioned options only work on attributes. Let me know if this works, PR to improve the docs are always welcome :)
from minimize.
@Swaagie I know you've mentioned in the README.md that PHP inline templates are not supported but adding functionality that would allow for certain start/end blocks to be ignored would solve that as well.
I was thinking about trying to implement this actually and perhaps it would require up to 2 passes where you don't actually ignore certain blocks but replace them with placeholders {{$1}} as necessary prior to the current HTML minification logic and restoring the map subsequently afterwards. Would this be possible? I'm desperately trying to achieve minification of PHTML for the HTML only portion (while ignoring PHP) --- <div>Hello <?php echo 'John'; ?></div>
Would this be possible or easy to integrate?
from minimize.
Sorry for the slow response, the only proper way to implement this would be by providing a custom DOM parser. Currently the domparser of htmlparser2 is used by default. This parser confuses the <?php ?>
of PHP with HTML. So parsing PHP templates would require a custom parser that understands these PHP tags. Minimize already supports custom parsers as argument of the constructor. But I think the simpler route is probably processing the templates after the PHP parser has inserted the variables and just before the content is send of the wire to the browser.
edit: as for replacing, that could be done probably as {{$1}}
would be seen as text by the parser. That is outside the scope of this module though. But it is something you could probably achieve reasonably simple yourself. By simply replacing the PHP tags before the template is run through minimize.
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.