Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Compile static site for production (with sourcemaps), auto-compiles files like `app.coffee -> app.js`
Compile/minify static site for production (with sourcemaps), auto-compiles files like app.coffee -> app.js
.
Currently supports: LiveScript
, babel
, coco
, coffee-script
, dogescript
, less
, marked
, myth
, jade
, node-sass
, stylus
, swig
. To use any of these you must do npm install x
as needed (where x
is the name of the lib), baconize does not install them by default.
var baconize = require('baconize');
var source = '/path/to/input/dir';
var target = '/path/to/output/dir';
baconize(source, target, [options]).then([successFn],[errorFn]);
How it works:
/path/to/input/dir
:For example, if you have a coffeescript file in /path/to/input/dir/my-app/scripts/index.coffee
then it will output the compiled file as /path/to/output/dir/my-app/scripts/index.js
, and the sourcemap as /path/to/output/dir/my-app/scripts/index.js.map
.
This library is designed for use alongside pingy-in-the-middle.
compile (Boolean, default = true): should baconize try to compile files where possible?
sourcemaps (Boolean, default = true): should baconize copy corresponding sourcemaps and source files for the minified/compiled files?
minify (Boolean, default = false): should baconize minify javascript, css and html files? Will also minify post-compilation files.
blacklist (Array): filter to blacklist files from being compiled or minifed. They will still be copied (without compilation/minifiction) unless they are negated using the fileFilter
or directoryFilter
options below. This option is useful for vendor directories (like 'bower_components') which already include the compiled versions of files. See Filters for more.
fileFilter (Array): filter to include/exclude files to be copied to target. See Filters for more.
directoryFilter (Array): filter to include/exclude directories to be copied to target, rules are applied to sub-directories also. Useful for directories like '.git'. See Filters for more.
depth (Number): depth at which to stop recursing even if more subdirectories are found.
exclusions (Object): Instead of blacklist
, fileFilter
and directoryFilter
you can use the new exclusions api, this is undocumented for the moment.
Filters take an array of glob strings. fileFilter
and directoryFilter
can be a whitelist or blacklist, by default they are whitelist but add the !
character before entries to turn them into a blacklist instead:
compileBlacklist: [ 'bower_components/**' ]
copies the raw 'bower_components' directory instead of compiling files within the directory.
fileFilter: [ '*.json', '*.js', '*.scss', '*.jade' ]
includes only JavaScript, JSON, SCSS and Jade files.
directoryFilter: [ '!.git', '!node_modules' ]
includes all directories except '.git' and 'node_modules'.
See minimatch for some examples of glob strings.
You can listen to chdir
and compile-start
and compile-finised
events emitted by baconize.
var bacon = baconize(source, target, [options]);
bacon.on('chdir', function(folder) {
// `folder` (string) is the current folder path that is being processed by baconize
});
bacon.on('compile-start', function(file) {
// compile has started on `file` (object).
//
// {
// name: 'typography.css',
// path: 'styles/typography.css',
// fullPath: '/Users/dave/Sites/my-site/styles/typography.css',
// parentDir: 'styles',
// fullParentDir: '/Users/dave/Sites/my-site/styles/',
// stat: {object} See: https://nodejs.org/api/fs.html#fs_class_fs_stats
// }
});
bacon.on('compile-done', function(file) {
// compile has finished successfully on `file` (object, see above).
});
You can abort baconize while it's in progress. If you do this then the promise will reject and the output directory will be removed.
var bacon = baconize(source, target, [options]);
// abort baconize while in progress
setTimeout(function() { bacon.abort(); }, 10);
bacon.then(function(){}, function(err) {
// err (Error)
// {
// message: 'Manually aborted by user',
// code: 'ABORT'
// }
})
The easiest way to try this out is to clone
the repo, cd
into it and do:
npm install
npm run example
This will compile a basic demo site to examples/output
.
FAQs
Compile static site for production (with sourcemaps), auto-compiles files like `app.coffee -> app.js`
The npm package baconize receives a total of 42 weekly downloads. As such, baconize popularity was classified as not popular.
We found that baconize 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.