Gathering detailed insights and metrics for gulp-usemin-reloaded
Gathering detailed insights and metrics for gulp-usemin-reloaded
Gathering detailed insights and metrics for gulp-usemin-reloaded
Gathering detailed insights and metrics for gulp-usemin-reloaded
npm install gulp-usemin-reloaded
Typescript
Module System
Min. Node Version
Node Version
NPM Version
JavaScript (95.31%)
HTML (4.35%)
CSS (0.35%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
6 Stars
40 Commits
3 Forks
2 Watchers
1 Branches
3 Contributors
Updated on Jan 17, 2019
Latest Version
0.2.1
Package Id
gulp-usemin-reloaded@0.2.1
Unpacked Size
16.86 kB
Size
5.69 kB
File Count
14
NPM Version
6.4.1
Node Version
8.12.0
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
5
A better usemin.
Once I've begun to develop using Gulp tasks and plugins, I've discovered that a lot of them are done in a really crappy way. The feature itself is cool but the code is unmanageable in the future. So, this is my effort to bring a better usemin with a cleaner logic and extensibility, but also proving a retrocompatibility layer with all existing usemin projects.
build:something
when you can write myrule:context
?)1npm install gulp-usemin-reloaded
As you already know there are some standard rules that usemin tasks were using like build:css
, build:js
or build:remove
. With this plugin we're going to extend those by using a more generic approach:
action:context outputPath [attributes]
where
action
is the name of your own task (i.e. build
)context
is the tag to recognize your task (i.e. css
)outputPath
is where you want this to be saved, relative to your gulp.dest
path (i.e. css/screen.css
)[attributes]
are tha HTML attributes to append to the output tag that will be replaced (i.e. media="screen"
)Usually usemin does everything out-of-the-box by itself, but since we're going to have custom Rules, we're also going to have custom callbacks to manage them. It's really simple to do that when you declare this plugin in your own gulpfile.js
.
1var usemin = require('gulp-usemin-reloaded'); 2 3.pipe( 4 usemin({ 5 rules: { 6 build: { 7 css: [minifyCss(), 'concat'], 8 js: [uglify(), rev()], 9 html: [minifyHtml({empty: true})], 10 remove: function( object, content ) { 11 return ''; 12 } 13 } 14 } 15 }) 16)
In this case the remove
task (aka context
) is declared as a callback.
as INPUT parameters you have:
object
is the parsed object of the current task rule (aka 'action`). It's a dictionary containing all the parsed HTML as a lookup dictionary.content
is the current evaluated content that can be manipulated directly from the callback.as OUTPUT it expect the handled content, in this case an empty string (we want to discard everything that is between <!-- build:remove -->
and <!-- endbuild -->
. The replacement will be done ALWAYS by the plugin and not by you. So do NOT ever return the modified 'content' parameter. That is only a READ-ONLY var that you can use to base your decision (do 'if' or some other logical operators).
You can declare as many actions and contexts you like. Their value can be:
array
of other tasks to be runcallback
as describedOf course the whole refactory is based on one logic. Every HTML tag is parsed as a dictionary and could be read and/or extend with different values. This is an example on how it will look like:
HTML
1<!-- build:remove --> 2<script src="js/null.js"></script> 3<!-- endbuild -->
DICTIONARY
1{ 2 action: 'build', 3 context: 'remove', 4 nodes: [ 5 { 6 _tagName: 'script', 7 src: 'js/null.js' 8 } 9 ], 10 startTag: 'build: remove', 11 endTag: 'endbuild', 12 files: [ 13 // List of Vinyl INPUT Files ( src/href for each HTML tag ) 14 ] 15}
See LICENSE file.
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 1/30 approved changesets -- score normalized to 0
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
Reason
SAST tool is not run on all commits -- score normalized to 0
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