Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
gulp-preprocess-file
Advanced tools
A Gulp plugin for Preprocess files based off environment configuration. Based on Preprocess package
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
var preprocess = require('gulp-preprocess-file');
gulp.task('test:html', () => {
gulp.src('./src/*.html')
.pipe(preprocess({
NODE_ENV: 'production',
title: 'this is a title',
cdnFile: function(file) {
return 'https://cdn.com/' + file
}
}, {
srcDir: './src/'
}))
.pipe(gulp.dest('dist/'))
})
html file
<body>
<h1><!-- @echo title --></h1>
<!-- @include ./text.html -->
<!-- @if NODE_ENV!='production' -->
<script src="./libs/jquery.min.js"></script>
<!-- @endif -->
<!-- @if NODE_ENV='production' -->
<script src="<!-- @exec cdnFile('dist/jquery.min.js') -->"></script>
<!-- @endif -->
<script>
var title = '<!-- @echo title -->' || 'Title'
</script>
</body>
Gulpfile
var preprocess = require('gulp-preprocess-file');
gulp.task('test:js', () => {
gulp.src(['./script/*.js'])
.pipe(preprocess({
NODE_ENV: 'production',
name: 'John'
}, {
type: 'js'
}))
.pipe(gulp.dest('dist/'))
})
test.js file
var ENV = '/* @echo NODE_ENV */' || 'development'
/* @if NODE_ENV='production' **
console.log('production')
/* @endif */
// @if NODE_ENV='production'
console.log('my name is /* @echo name */')
// @endif
more: preprocess#configuration
preprocess(context, options)
context
Type: Object
more: preprocess#context
options
Type: Object
more: preprocess#options
API
gulp-preprocess-file
Based on Preprocess package
MIT © Mervin
FAQs
A Gulp plugin for Preprocess files based off environment configuration. Based on Preprocess package
We found that gulp-preprocess-file demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.