-
-
Notifications
You must be signed in to change notification settings - Fork 57
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
gulp-htmlmin hangs...no errors #35
Comments
can you paste your gulpfile here or in a gist? |
Thanks for responding! Here's the task that handles my templates (and the rest of my app JS). If i switch back to var gulp = require( "gulp" );
var eventStream = require( "event-stream" );
var concat = require( "gulp-concat" );
var changed = require( "gulp-changed" );
var flatten = require( "gulp-flatten" );
// var minifyHtml = require( "gulp-minify-html" );
var htmlmin = require( "gulp-htmlmin" );
var angularTemplatecache = require( "gulp-angular-templatecache" );
var coffee = require( "gulp-coffee" );
var ngAnnotate = require( "gulp-ng-annotate" );
gulp.task( "appJs", function(cb){
function _templates(){
return gulp.src( ["./src/**/*.html"] )
.pipe( flatten() )
// .pipe( minifyHtml() )
.pipe(
htmlmin({
collapseWhitespace: true,
removeComments: true,
removeAttributeQuotes: true
})
)
.pipe( angularTemplatecache() )
}
function _coffeescript(){
return gulp.src( ["./src/**/*module.coffee", "./src/**/*.coffee"] )
.pipe( coffee() )
.pipe( ngAnnotate() )
}
return eventStream.merge( _templates(), _coffeescript() )
.pipe( changed( "./dist/js" ) )
.pipe( concat( "app.js" ) )
.pipe( gulp.dest( "./dist/js" ) )
}); and my {
"...": "...",
"devDependencies": {
"coffee-script": "1.10.0",
"del": "2.2.0",
"event-stream": "3.3.2",
"gulp": "3.9.0",
"gulp-angular-templatecache": "1.8.0",
"gulp-changed": "1.3.0",
"gulp-coffee": "2.3.1",
"gulp-concat": "2.6.0",
"gulp-cssnano": "2.0.0",
"gulp-flatten": "0.2.0",
"gulp-htmlmin": "1.3.0",
"gulp-minify-html": "1.0.5",
"gulp-ng-annotate": "1.1.0",
"gulp-rev": "6.0.1",
"gulp-rev-collector": "1.0.2",
"gulp-sass": "2.1.1",
"gulp-shell": "0.5.1",
"gulp-strip-comments": "1.1.2",
"gulp-uglify": "1.5.1",
"gulp-util": "^3.0.7",
"gulp-watch": "4.3.5",
"jasmine-core": "2.3.4",
"karma-chrome-launcher": "0.2.0",
"karma-coffee-preprocessor": "0.3.0",
"karma-jasmine": "0.3.6",
"karma-ng-html2js-preprocessor": "0.1.2",
"q": "1.4.1",
"require-dir": "0.3.0",
"run-sequence": "1.1.5"
}
} |
@uberspeck Slim down your gulpfile to clarify what is the root cause. Yours includes a lot of code unrelated to this issue. |
I am facing the similar issue here. My package.json {
"engines": {
"node": "~0.12.x",
"npm": "~3.5.x"
},
"dependencies": {},
"devDependencies": {
"del": "^2.0.2",
"gulp": "~3.9.0",
"gulp-angular-templatecache": "^1.8.0",
"gulp-concat": "^2.5.2",
"gulp-eslint": "^1.0.0",
"gulp-htmlhint": "^0.3.0",
"gulp-htmlmin": "^1.3.0",
"gulp-if": "~2.0.0",
"gulp-insert": "^0.5.0",
"gulp-minify-css": "^1.0.0",
"gulp-ng-annotate": "^1.1.0",
"gulp-rev": "^6.0.1",
"gulp-sourcemaps": "^1.6.0",
"gulp-strip-debug": "^1.0.2",
"gulp-uglify": "^1.1.0",
"gulp-util": "~3.0.6",
"htmlhint-stylish": "^1.0.3"
},
"optionalDependencies": {}
} My gulpfile.js, complete code gulp.task('dist:partials', function () {
return gulp.src('./public/src/views/**/*.html')
.pipe(htmlmin({
collapseWhitespace: true,
removeComments: true,
removeEmptyAttributes: false,
removeEmptyElements: false
}))
.pipe(templateCache({
filename: 'partials.min.js',
module: 'angularApp',
root: 'src/views/',
standalone: false
}))
.pipe(gulp.dest('./public/dist/js'))
.on('error', gutil.log);
}); My gulp task never ends.
I also tried to rename file to a shorter name "config-condition-q-d.html" , But no luck . Another point is that i also tried this plugin in a different project (where i have less number of html files to process) and it worked fine there. FYI : Let me know how can i help you , thanks. |
I'm having the same issue as well. It's working just fine for a single file but when my src includes several files the files are minified and output to the dest folder but the task never completes |
@Ank91 I don't think this would be caused by the filename. It would be great if you could narrow down what is causing the issue inside the file by removing and re-adding sections. this is probably an issue with |
Found culprit code <!-- invalid html -->
<input type="text" class="form-control" ng-model="option.grades[grade.grade][gender.id].view_amount"
name="{{option.option_text + "_" + grade.grade + "_" + gender.id}}" > The problem was with the invalid html, did you notice double quotes in <!-- valid html -->
<input type="text" class="form-control" ng-model="option.grades[grade.grade][gender.id].view_amount"
name="{{option.option_text + '_' + grade.grade + '_' + gender.id}}"> So make sure your html code is valid. You can also use w3c-checker |
I'm having the same issue with the plugin choking on bad HTML. Obviously I need to fix the HTML, but could we have the plugin ignore bad html or report on the file that is causing it? The html that it's choking on is the following (notice the missing closing angle bracket):
|
This appears to be a known issue with html-minifier. kangax/html-minifier#332, kangax/html-minifier#177 This issue could probably be closed. |
closing based on last comment. thanks |
@rscottfree agreed was able to fix the problem with my syntax error but had I not found this post. I would've struggled with error message. |
Same issue for me, but I'm not getting any errors reported back to me? Both referenced issues in the html minifier seem to be resolved |
I just tried switching from
gulp-minify-html
togulp-htmlmin
. Gulp processing just hangs now. No errors or anything. Anyone have any suggestions?The text was updated successfully, but these errors were encountered: