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.
fingerprint-brunch
Advanced tools
A Brunch plugin which renames assets with a SHA (generated from file content) to fingerprint it.
You're allowed to fingerprint specific files, assets folders, generated files and css linked assets.
npm install fingerprint-brunch --save-dev
You can find here a working setup with fingerprint-brunch
Optional You can override fingerprint-brunch's default options by updating your brunch-config.coffee
with your custom parameters.
String
) Defaults to ./assets.json
String
) Defaults to example/
key
string in the mapping fileString
) Defaults to out/
value
string in the mapping fileInteger
) Defaults to 8
Boolean
) Defaults to false
String|Array
) Defaults to *
joinTo
like ['app.js', 'vendor.js', ...]Array
) Defaults to ['production']
Boolean
) Defaults to false
Boolean
) Defaults to false
jointTo
files. It will be finded with url('path/to/assets.jpg')
in your css (for now)string
) Defaults to /public
../../public/theme/theme-1/
in css
your fonts, images will be linked like that : /theme/theme-1/img/troll.png
.publicRootPath
with ../../public
to conserve correct link in your css..Boolean
) Defaults to false
Boolean|String|Array
) Defaults to false
public
), all files will be fingerprinted and added to the manifest'/img'
or ['/img', '/svg']
Boolean|String|Array
) Defaults to false
'/img/troll.png'
or ['/img/troll.png', '/svg/logo.svg']
RegExp Object
) Defaults to new RegExp(/url\([\'\"]?[a-zA-Z0-9\-\/_.:]+\.(woff|woff2|eot|ttf|otf|jpg|jpeg|png|bmp|gif|svg)\??\#?[a-zA-Z0-9\-\/_]*[\'\"]?\)/g)
url()
attributeRegex
) Defaults to /(\?|\&|\#)([^=]?)([^&]*)/gm
exports.config =
# ...
plugins:
fingerprint:
manifest: './assets.json'
srcBasePath: './exemple/'
destBasePath: './out/'
hashLength: 8
autoClearOldFiles: false
targets: '*'
environments: ['production']
alwaysRun: false
autoReplaceAndHash: false
publicRootPath: './public'
manifestGenerationForce: false
foldersToFingerprint: false
assetsToFingerprint: false
{
"css/master.css": "css/master-364b42a1.css",
"js/master.js": "js/master-cb60c02b.js",
"img/troll.png": "img/troll-5f2d5cbe.png",
"fonts/font.eot": "fonts/font-45d860a3.eot",
"fonts/font.woff": "fonts/font-6ced13b9.woff",
"fonts/font.ttf": "fonts/font-82c653e7.ttf",
"fonts/font.svg": "fonts/font-52343d4f.svg"
}
To get this kind of result in your manifest you need to :
autoReplaceAndHash
to true
foldersToFingerprint
pointing to one folder (or many) ./img
assetsToFingerprint
pointing to a file (or many) ./img/troll.png
Use srcBasePath
and destBasePath
to remove some part of path files in the manifest.
Run npm i && npm test
Pull requests are welcome. If you add functionality, then please add unit tests to cover it.
« Copyright © David Lepaux
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
The Software is provided “as is”, without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the Software. »
FAQs
A Brunch JS plugin for cache busting assets
The npm package fingerprint-brunch receives a total of 17 weekly downloads. As such, fingerprint-brunch popularity was classified as not popular.
We found that fingerprint-brunch 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.