Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Gulp cache busting with development or production mappings
npm install gulp-bust
var gulp = require('gulp'),
Bust = require('gulp-bust');
var bust = new Bust();
gulp.task('assets', function () {
return gulp.src(['src/img/*.png', 'src/css/*.css', 'src/js/*.js'])
.pipe(bust.resources())
.pipe(gulp.dest('dist/public'));
});
gulp.task('templates', function () {
return gulp.src('src/templates/*')
.pipe(bust.references())
.pipe(gulp.dest('views'));
});
var bust = new Bust([options]);
Options can be set on initialisation or at a later point by dirrectly updating the settings hash.
bust.settings.production = false;
hashLength (number)
default: false
Numerical value if you wish to shorten your checksum length. e.g.
new Bust({ hashLength: 12 });
Will cut checksum hashes down to 12 characters.
hashType (string)
default 'md5'
Any Node crypto hash type. e.g.
new Bust({ hashType: 'sha1' });
production (boolean)
default true
Boolean flag to set/unset production mode.
When set to false Bust will not add checksum hashes to files but will generate a mappings object.
bust.resources()
Renames and maps to resources as they pass through. Checksums are generated against file contents so will only change if the file contents change. So a file such as: foo.png
might become: foo.3858f62230ac3c915f300c664312c63f.png
. All file references will also be recorded on the mappings object.
bust.references()
Updates file content such as your templates to refer to files previously renamed by bust.resources(). A template such as:
html
head
link(href='/public/css/style.css', rel='stylesheet')
body
might become:
html
head
link(href='/public/css/style.3858f62230ac3c915f300c664312c63f.css', rel='stylesheet')
body
The mappings object can be accessed via bust.mappings and can be useful for referring to dynamically rendered content within templates.
By default when the production flag in settings is set to true the mappings object will look something like:
{
"foo.png": "foo.3858f62230ac3c915f300c664312c63f.png",
"bar.css": "bar.6754fsd205aasd944d523sd4so40i98d.css"
}
If the production flag is set to false the mappings object will look something like:
{
"foo.png": "foo.png",
"bar.css": "bar.css"
}
18 February 2015: 0.2.2
FAQs
Gulp cache busting with development or production mappings
The npm package gulp-bust receives a total of 6 weekly downloads. As such, gulp-bust popularity was classified as not popular.
We found that gulp-bust 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
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.