Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
assets-packager
Advanced tools
Very fast assets pipeline - combines power of async, uglify-js, clean-css, enhance-css and couple other tools to make your assets production-ready
Assets-packager is a tool for compiling, minifying, and packaging CSS and JavaScript assets into production-ready packages.
CSS bundles are created from assets which are:
Similarly JavaScript files are:
node.js 0.8.0+ on *nix (fully tested on OS X 10.6+ and CentOS) and Windows
npm install -g assets-packager
OK. Here are commands to run
git clone git@github.com:jakubpawlowicz/assets-packager.git
cd assets-packager/examples
assetspkg -c assets.yml -g
Now check examples/public/javascripts/bundled and examples/public/stylesheets/bundled for bundled code. That's it!
You should have just witnessed it by yourself. :-)
It is used as a part of build process for GoalSmashers.com and it takes around 10 seconds to buld 40 CSS and 20 JavaScript bundles from hundreds of assets.
So yes, it is fast!
First of all it assumes Rails-like directory structure for your assets, e.g:
Then it needs a configuration file (here we name it assets.yml) with a definition of JS/CSS bundles, e.g:
stylesheets:
application: 'reset,grid,base,application'
javascripts:
application:
- 'vendor/jquery'
- 'application,helpers'
We recommend placing it somewhere else than in your public folder.
Now you can bundle all these packages with a single command:
assetspkg -c assets.yml
All the packages go into public/javascripts/bundled and public/stylesheets/bundled.
Assets-packager accepts the following command line arguments:
assetspkg [options]
-h, --help output usage information
-v, --version output the version number
-b, --cache-boosters add MD5 hash to file names aka hard cache boosters
-c, --config [path] path to file with bundles definition (defaults to ./config/assets.yml)
--css-asset-hosts [list] assets host prefix URLs with in CSS bundles
--css-bundle-to [path] path to stylesheets root directory (relative to --root option)
--css-embed-all forces embedding of all resources by enhance-css
--css-safe-embed create an additional version of packaged CSS without embedded images
--css-source [path] path to stylesheets root directory (relative to --root option)
-g, --gzip gzip packaged files
-j, --concurrent [value] number of concurrent tasks executed at once (defaults to number of logical CPUs)
--js-bundle-to [path] path to JavaScript root directory (relative to --root option)
--js-indent [value] indentation level in spaces when used with --js-no-minify switch
--js-line-break-at [value] number of characters per line in optimized JavaScript (defaults to no limit)
--js-no-minify turn off JS minification
--js-source [path] path to JavaScript root directory (relative to --root option)
-o, --only [list] package only given assets group or groups if separated by comma(s)
-r, --root [path] root directory with assets directories (defaults to ./public)
First clone the source, then run:
npm run check
to check JS sources with JSHintnpm test
for the test suiteOpen an issue. Or better: fork the project, add the feature (don't forget about tests!) and send a pull request.
--nominifyjs
and --indent
options allow for combination-only processing.Assets-packager is released under the MIT License.
FAQs
Very fast assets pipeline - combines power of async, uglify-js, clean-css, enhance-css and couple other tools to make your assets production-ready
The npm package assets-packager receives a total of 3 weekly downloads. As such, assets-packager popularity was classified as not popular.
We found that assets-packager 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
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.