gruntjs - Disable tag completion in (grunt-contrib-)htmlmin -


i have rather typical php project in header/footer parts of pages reused , therefore placed in separate files require main file.

this means, however, _header.php-file ends in open <article> tag (which "closed" @ beginning of _footer.php).

the problem htmlmin interprets error on part , adds closing article, body , html tags in _header.php. how 'disable' that? i've read through github pages of grunt-contrib-htmlmin and html-minifier without luck.

my task config

htmlmin: {                                           dist: {                                              options: {                minifyjs: true,             removecomments: true,             collapsewhitespace: true         },         files: {                                             'staging/index.php': 'index.php',             'staging/support/index.php': 'support/index.php',             'staging/inc/_header.php': 'inc/_header.php',             'staging/inc/_footer.php': 'inc/_footer.php'         }     } } 

bonus brownie points if can tell why minifyjs: true seems ignored

thanks.

i searched solution, looked @ documentation, read several blog posts , found out @ time asking impossible.

moreover asked similar question on github, support html fragments, closed answer:

hm, don't think there's can this, since minifier needs context aware , can't understand arbitrary, partial chunk of html.

so not possible , (probably) not going implemented in future.

you can't block process (with grunt-contrib-htmlmin) because intent prevent users leaving "uncorrect code".

i did not find other equivalent grunt-plugin gives possibility.

in end think have 2 "solutions" left:

1)not minifying php fragments;

2)divide code more parts, minify 1 without unclosed tags, , reunite them using grunt-include-replace, or similar plugin, in new php file.


Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -