Gathering detailed insights and metrics for gulp-preprocess-file
Gathering detailed insights and metrics for gulp-preprocess-file
Gathering detailed insights and metrics for gulp-preprocess-file
Gathering detailed insights and metrics for gulp-preprocess-file
A Gulp plugin for Preprocess files based off environment configuration. Based on Preprocess package
npm install gulp-preprocess-file
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
1 Stars
11 Commits
1 Branches
1 Contributors
Updated on Jun 10, 2020
Latest Version
2.1.0
Package Id
gulp-preprocess-file@2.1.0
Unpacked Size
4.50 kB
Size
1.88 kB
File Count
4
NPM Version
6.8.0
Node Version
10.14.2
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
4
A Gulp plugin for Preprocess
Preprocess HTML, JavaScript, and other files with directives based off custom or ENV configuration
$ npm install --save-dev gulp-preprocess-file
Gulpfile
1var preprocess = require('gulp-preprocess-file'); 2 3gulp.task('test:html', () => { 4 gulp.src('./src/*.html') 5 .pipe(preprocess({ 6 NODE_ENV: 'production', 7 title: 'this is a title', 8 cdnFile: function(file) { 9 return 'https://cdn.com/' + file 10 } 11 }, { 12 srcDir: './src/' 13 })) 14 .pipe(gulp.dest('dist/')) 15})
html file
1<body> 2<h1><!-- @echo title --></h1> 3<!-- @include ./text.html --> 4 5<!-- @if NODE_ENV!='production' --> 6<script src="./libs/jquery.min.js"></script> 7<!-- @endif --> 8<!-- @if NODE_ENV='production' --> 9<script src="<!-- @exec cdnFile('dist/jquery.min.js') -->"></script> 10<!-- @endif --> 11<script> 12var title = '<!-- @echo title -->' || 'Title' 13</script> 14</body>
Gulpfile
1var preprocess = require('gulp-preprocess-file'); 2 3gulp.task('test:js', () => { 4 gulp.src(['./script/*.js']) 5 .pipe(preprocess({ 6 NODE_ENV: 'production', 7 name: 'John' 8 }, { 9 type: 'js' 10 })) 11 .pipe(gulp.dest('dist/')) 12})
test.js file
1var ENV = '/* @echo NODE_ENV */' || 'development' 2 3/* @if NODE_ENV='production' ** 4console.log('production') 5/* @endif */ 6 7// @if NODE_ENV='production' 8console.log('my name is /* @echo name */') 9// @endif
more: preprocess#configuration
1preprocess(context, options)
context
Type: Object
more: preprocess#context
options
Type: Object
more: preprocess#options
API
gulp-preprocess-file
Based on Preprocess package
MIT © Mervin
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
no SAST tool detected
Details
Reason
Found 0/11 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- 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
license file not detected
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