Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

browserify-css

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

browserify-css - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

24

index.js

@@ -11,6 +11,9 @@ 'use strict';

var defaults = {
'auto-inject': true,
'autoInject': true,
'autoInjectOptions': {
'verbose': true
},
'rootDir': process.cwd(),
'minify': false,
'minify-options': {
'minifyOptions': {
// Check out a list of CSS minify options at [CleanCSS](https://github.com/jakubpawlowicz/clean-css#how-to-use-clean-css-programmatically).

@@ -45,3 +48,3 @@ }

cssTransform({ rootDir: options.rootDir }, filename, function(data) {
cssTransform({ rootDir: options['rootDir'] }, filename, function(data) {
var moduleBody = '';

@@ -52,11 +55,14 @@ var rootDir = path.join(process.cwd(), options.rootDir);

if (options.minify) {
data = new CleanCSS(options['minify-options']).minify(data);
if (options['minify']) {
data = new CleanCSS(options['minifyOptions']).minify(data);
}
if ( ! options['auto-inject']) {
if ( ! options['autoInject']) {
moduleBody = 'module.exports = ' + JSON.stringify(data) + ';'
} else if (options['injected-tag'] === 'style') { // <style>
moduleBody = 'var css = ' + JSON.stringify(data) + '; (require(' + JSON.stringify(__dirname) + ').createStyle(css, { "href": ' + JSON.stringify(href) + '})); module.exports = css;'
} else {
if (options.autoInjectOptions['verbose']) {
moduleBody = 'var css = ' + JSON.stringify(data) + '; (require(' + JSON.stringify(__dirname) + ').createStyle(css, { "href": ' + JSON.stringify(href) + '})); module.exports = css;'
} else {
moduleBody = 'var css = ' + JSON.stringify(data) + '; (require(' + JSON.stringify(__dirname) + ').createStyle(css)); module.exports = css;'
}
}

@@ -63,0 +69,0 @@

{
"name": "browserify-css",
"version": "0.1.0",
"version": "0.2.0",
"description": "A Browserify transform for bundling, rebasing, inlining, and minifying CSS files",

@@ -20,2 +20,3 @@ "main": "./index.js",

"dom",
"minify",
"transform"

@@ -22,0 +23,0 @@ ],

# browserify-css #
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.

@@ -51,3 +51,3 @@ ## Getting Started

"browserify-css": {
"auto-inject": true,
"autoInject": true,
"minify": true,

@@ -69,3 +69,3 @@ "rootDir": "."

module.exports = {
"auto-inject": true,
"autoInject": true,
"minify": true,

@@ -78,3 +78,3 @@ "rootDir": "."

### auto-inject
### autoInject

@@ -86,2 +86,14 @@ Type: `Boolean`

### autoInjectOptions
Type: `Object`
Default:
``` json
{
verbose: true
}
```
If verbose is set to true, the path to CSS will be specified in the data-href attribute inside the style tag
### rootDir

@@ -99,3 +111,3 @@

### minify-options
### minifyOptions

@@ -102,0 +114,0 @@ Type: `Object`

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc