
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
browserify-css
Advanced tools
A Browserify transform for bundling, rebasing, inlining, and minifying CSS files
A Browserify transform for bundling, rebasing, inlining, and minifying CSS files. It's useful for CSS modularization where styles are scoped to their related bundles.
If you're new to browserify, check out the browserify handbook and the resources on browserify.org.
npm install --save-dev browserify-css
app.css:
@import url("modules/foo/index.css");
@import url("modules/bar/index.css");
body {
background-color: #fff;
}
app.js:
var css = require('./app.css');
console.log(css);
You can compile your app by passing -t browserify-css to browserify:
$ browserify -t browserify-css app.js > bundle.js
Each require('./path/to/file.css')
call will concatenate CSS files with @import statements, rebasing urls, inlining @import, and minifying CSS. It will add a style tag with an optional data-href attribute to the head section of the document during runtime:
<html>
<head>
<style type="text/css" data-href="app.css">...</style>
</head>
</html>
You can put your browserify-css options into your package.json file:
{
"browserify-css": {
"autoInject": true,
"minify": true,
"rootDir": "."
}
}
or use an external configuration file like below:
{
"browserify-css": "./config/browserify-css.js"
}
config/browserify-css.js:
module.exports = {
"autoInject": true,
"minify": true,
"rootDir": "."
};
Type: Boolean
Default: true
If true, each require('path/to/file.css')
call will add a style tag to the head section of the document.
Type: Object
Default:
{
verbose: true
}
If verbose is set to true, the path to CSS will be specified in the data-href attribute inside the style tag
Type: String
Default: ./
An absolute path to resolve relative paths against the project's base directory.
Type: Boolean
Default: false
Type: Object
Default: {}
Check out a list of CSS minify options at CleanCSS.
MIT
FAQs
A Browserify transform for bundling, rebasing, inlining, and minifying CSS files
The npm package browserify-css receives a total of 4,156 weekly downloads. As such, browserify-css popularity was classified as popular.
We found that browserify-css 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
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.