Questions tagged [gulp-usemin]

gulp-usemin is a gulp plugin that can replace references to non-optimized JavaScript or CSS files in a set of HTML files.

gulp-usemin is a gulp plugin that can replace references to non-optimized (e.g., non-minified) JavaScript or CSS files in a set of HTML files (views, templates).

Example of usage:

var usemin = require('gulp-usemin');
var uglify = require('gulp-uglify');
var minifyHtml = require('gulp-minify-html');
var minifyCss = require('gulp-minify-css');
var rev = require('gulp-rev');

gulp.task('usemin', function () {
  return gulp.src('./*.html')
    .pipe(usemin({
      css: [minifyCss(), 'concat'],
      html: [minifyHtml({empty: true})],
      js: [uglify(), rev()]
    }))
    .pipe(gulp.dest('./build/'));
});
23 questions
0
votes
0 answers

error when running "gulp "

when I tried to run gulp in my webapp folder an error occured: " [14:16:06] Finished 'jshint' after 813 ms [14:16:06] Starting 'usemin'... Unhandled rejection Error: ϵͳ�Ҳ���ָ����·���� at notFoundError…
Clark.Xu
  • 25
  • 4
0
votes
2 answers

How could i code this more efficiently? - a gulp task

Maybe someone with a bit more java script experience than myself can answer this. So far I've made a copy & paste from the 'usemin' block as shown in a course. Here's the code: gulp.task('useminTrigger', ['deleteDistFolder'], function() { …
georg
  • 21
  • 5
0
votes
2 answers

Gulp Usemin not doing anything

I have multiple apps in one project, so I have this task: gulp.task('usemin', function() { return gulp.src('/app1/index.html') .pipe(usemin({ js: [ uglify(), rev() ] })) .pipe(gulp.dest('app1/build/')); }); And this is the…
ilyo
  • 35,851
  • 46
  • 106
  • 159
0
votes
0 answers

Gulp usemin exclude files

Let's have index.html
kxyz
  • 802
  • 1
  • 9
  • 32
0
votes
1 answer

My gulp usemin task missing a js file

I am using gulp usemin task to combine and minimize/uglify the css and js files in my HTML. gulp.task('usemin',['jshint'], function () { return gulp.src('./app/**/*.html') .pipe(usemin({ css:[minifycss(),rev()], js:…
Kevin Li
  • 1
  • 1
0
votes
1 answer

How to normalize html before usemin

Some of our devs have mac and some have PC - and there seems to be an issue with usemin when trying to run it - as whitespaces (CRLF and LF) are interchanging and messing it up. Is there some kind of plugin or regex I can use in my gulpfile to fix…
itamar
  • 3,837
  • 5
  • 35
  • 60
0
votes
1 answer

How to add "gulp-uncss" to "gulp-usemin"

Actually I have this, but I want to add uncss plugin. Or how I can add dynamically references. var usemin = require('gulp-usemin'); var uglify = require('gulp-uglify'); var uncss = require('gulp-uncss'); var minifyHtml =…
Mr SC
  • 162
  • 2
  • 11
0
votes
1 answer

Output JS and HTML to different locations using Gulp Usemin

I'm using gulp-usemin to combine my JS files (with uglify) I have a folder structure as follows: Top |- Web |- Scripts |- App |- script1.js |- script2.js |- Vendor (folder) |-…
vernak2539
  • 574
  • 3
  • 14
1
2