Gathering detailed insights and metrics for gulp-usemin2
Gathering detailed insights and metrics for gulp-usemin2
Gathering detailed insights and metrics for gulp-usemin2
Gathering detailed insights and metrics for gulp-usemin2
npm install gulp-usemin2
Typescript
Module System
Min. Node Version
NPM Version
JavaScript (98.85%)
CSS (1.15%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
7 Stars
51 Commits
1 Forks
1 Watchers
1 Branches
1 Contributors
Updated on Nov 01, 2017
Latest Version
0.2.4
Package Id
gulp-usemin2@0.2.4
Size
9.46 kB
NPM Version
1.3.24
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
Replaces references to non-optimized scripts or stylesheets into a set of HTML files (or any templates/views).
This task is designed for gulp 3.
Attention: v0.2.0 does not minify the files by default.
First, install gulp-usemin
as a development dependency:
1npm install --save-dev gulp-usemin
Then, add it to your gulpfile.js
:
1var usemin = require('gulp-usemin'); 2var uglify = require('gulp-uglify'); 3var minifyHtml = require('gulp-minify-html'); 4var minifyCss = require('gulp-minify-css'); 5 6gulp.task('usemin', function() { 7 gulp.src('./*.html') 8 .pipe(usemin({ 9 cssmin: minifyCss(), 10 htmlmin: minifyHtml(), 11 jsmin: uglify() 12 })) 13 .pipe(gulp.dest('build/')); 14});
Blocks are expressed as:
1<!-- build:<type>(alternate search path) <path> --> 2... HTML Markup, list of script / link tags. 3<!-- endbuild -->
js
or css
An example of this in completed form can be seen below:
1<!-- build:css style.css --> 2<link rel="stylesheet" href="css/clear.css"/> 3<link rel="stylesheet" href="css/main.css"/> 4<!-- endbuild --> 5 6<!-- build:js js/app.js --> 7<script src="js/app.js"></script> 8<script src="js/controllers/thing-controller.js"></script> 9<script src="js/models/thing-model.js"></script> 10<script src="js/views/thing-view.js"></script> 11<!-- endbuild -->
Type: Object
Plugin for minify output css.
Type: Object
Plugin for minify output html.
Type: Object
Plugin for minify output js.
Type: String
Alternate root path for assets. New concated js and css files will be written to the path specified in the build block, relative to this path. Currently asset files are also returned in the stream.
Type: Boolean
Default: false
If true use gulp-rev to revision and rename the asset files. The new asset file names will automatically be used in the html tags.
|
+- app
| +- index.html
| +- assets
| +- js
| +- foo.js
| +- bar.js
| +- css
| +- clear.css
| +- main.css
+- dist
We want to optimize foo.js
and bar.js
into optimized.js
, referenced using relative path. index.html
should contain the following block:
<!-- build:css style.css -->
<link rel="stylesheet" href="css/clear.css"/>
<link rel="stylesheet" href="css/main.css"/>
<!-- endbuild -->
<!-- build:js js/optimized.js -->
<script src="assets/js/foo.js"></script>
<script src="assets/js/bar.js"></script>
<!-- endbuild -->
We want our files to be generated in the dist
directory. gulpfile.js
should contain the following block:
1gulp.task('usemin', function(){ 2 gulp.src('./app/index.html') 3 .pipe(usemin({jsmin: uglify()})) 4 .pipe(gulp.dest('dist/')); 5});
This will generate the following output:
|
+- app
| +- index.html
| +- assets
| +- js
| +- foo.js
| +- bar.js
+- dist
| +- index.html
| +- js
| +- optimized.js
| +- style.css
index.html
output:
<link rel="stylesheet" href="style.css"/>
<script src="js/optimized.js"></script>
#####0.2.2
#####0.2.1
#####0.2.0
#####0.1.4
#####0.1.3
#####0.1.1
#####0.1.0
#####0.0.2
#####0.0.1
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More