Questions tagged [grunt-contrib-htmlmin]

A grunt plugin to minify HTML

19 questions
10
votes
1 answer

HTMLmin - How to dynamically compress all files inside a certain folder

I want to minify all HTML pages and maintain the page's name and path on the dist folder. I want to loop through all folders. The code below works fine but ONLY for the parent folder (which is this case app/views). grunt.initConfig({ htmlmin: { …
Muhammad Reda
  • 26,379
  • 14
  • 93
  • 105
10
votes
5 answers

Grunt usemin: concatenated JavaScript file not replaced in index.html file

I started with an empty project generated by yeoman, and tried to edit the Gruntfile.js to fit my needs. The grunt build task reads my index.html file, and concatenates my bower dependencies and generates a .vendor.js file. I broke something in the…
5
votes
1 answer

Piping A Grunt task output to another task input?

I want to minify my Handlebars HTML templates before compiling them. I was wondering is it possible to pipe the output of grunt-contrib-htmlmin as input to grunt-contrib-handlebars without making an intermediate file.
bozhidarc
  • 834
  • 1
  • 11
  • 25
4
votes
2 answers

How to not remove some knockout-specific comments using grunt-contrib-htmlmin?

I am trying to use grunt-contrib-html to minify my html. The only problem that I am using knockout with containerless control flow syntax, which is just html comments, but they are really important to knockout:
  • This item always…
Salvador Dali
  • 214,103
  • 147
  • 703
  • 753
3
votes
3 answers

Disable tag completion in (grunt-contrib-)htmlmin

I have a rather typical PHP project in which the header/footer parts of pages are reused and therefore placed in separate files that I simply require from the main file. This means, however, that my _header.php-file ends in an open
tag…
Lasse
  • 1,414
  • 11
  • 19
2
votes
2 answers

grunt htmlmin: don't specify filename in the gruntfile.js

my task is the following: htmlmin : { dist : { options : { removeComments : true, collapseWhitespace : true }, files : { 'index.html' : 'index-src.html' …
valerio0999
  • 11,458
  • 7
  • 28
  • 56
1
vote
1 answer

Something in my html code is giving me a Parse Error using Grunt htmlmin

I am getting a parse error when trying to use grunt htmlmin this happens when I run my grunt build when I run with a --force I get that 2 of the three pages return an error. I think there is something wrong with my HTML potentially where do I need…
Phil S
  • 63
  • 1
  • 8
1
vote
0 answers

How to stop Jekyll from overriding Grunt's minified HTML files?

I'm using Jekyll to build a simple static website and Grunt to manage assets. I'm trying to get grunt-contrib-htmlmin to minify my Jekyll templates. When I run jekyll build it takes my template files and places them in the _site directory. htmlmin…
DDiran
  • 533
  • 1
  • 6
  • 23
1
vote
0 answers

how to use grunt htmlmin with mustache?

I am using grunt htmlmin with mustache template, however, it seems not capable with the {{#mustache}} tag. For example,
Benber Zhang
  • 71
  • 2
  • 5
1
vote
0 answers

Grunt htmlmin minifies only the first template in an ejs file

I'm developing an angular application and uses ejs to create template and grunt to concat(js, css) minify (js, css and html) and uglify (js) the files. The index.ejs: <%…
Gilad S
  • 1,753
  • 1
  • 13
  • 14
1
vote
2 answers

Grunt htmlmin errors

I'm using grunt-contrib-htmlmin plugin. This is how my Gruntfile.js looks like: module.exports = function(grunt) { grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), htmlmin: { dist: { options: { …
Tommz
  • 3,393
  • 7
  • 32
  • 44
0
votes
1 answer

htmlmin: pass in string get error: unicode argument expected, got 'str'

I am a newb to Python and can't figure this out. I have a html string stored as myHtmlString, but get error: unicode argument expected, got 'str'. I am trying to minify the html string and remove extra spaces. import htmlmin myHtmlString ="""
0
votes
0 answers

htmlmin on liquid templates error

I am creating my own Shopify Theme in the liquid templates. I installed laravel-elixir and gulp to help combine my css and js as well as minify my html. When running gulp I get an error that says: events.js:160 throw er; // Unhandled 'error'…
Varcor
  • 69
  • 1
  • 5
0
votes
0 answers

Minify CSS included in html header with grunt task

I have html file width css file included in head section that has been minified with cssmin, additionally the html has been minified with htmlmin grunt task succesfully, but there is a little problem with html minified, the css and javascript…
xzegga
  • 3,051
  • 3
  • 25
  • 45
0
votes
1 answer

Grunt htmlmin clean-css breaking my Handlebars code within tags

I have minifyCSS set to true in my Gruntfile.js htmlmin section like so: htmlmin: { dist: { options: { removeComments: true, collapseWhitespace: true, minifyJS: true, minifyCSS:…
D.Tate
  • 2,289
  • 3
  • 22
  • 35
1
2