New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.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.3.1 to 0.3.2

.travis.yml

36

css-transform.js

@@ -13,3 +13,3 @@ 'use strict';

return !! url.parse(path).protocol;
}
};

@@ -42,7 +42,7 @@ var isRelativePath = function(path) {

var r;
while (r = urlRegEx.exec(source)) {
var url = r[2] // url("path/to/foo.css");
|| r[3] // url('path/to/foo.css');
|| r[1] // url(path/to/foo.css)
|| '';
while ((r = urlRegEx.exec(source))) {
var url = r[2] || // url("path/to/foo.css");
r[3] || // url('path/to/foo.css');
r[1] || // url(path/to/foo.css)
'';
var quoteLen = ((r[2] || r[3]) && r[1]) ? 1 : 0;

@@ -53,3 +53,3 @@ var newUrl = url;

// if both r[2] and r[3] are undefined, but r[1] is a string, it will be the case of url(path/to/foo.css)
var quoteLen = ((r[2] || r[3]) && r[1]) ? 1 : 0;
quoteLen = ((r[2] || r[3]) && r[1]) ? 1 : 0;

@@ -78,3 +78,2 @@ var dirname = path.dirname(filename);

_.each(rules, function(rule) {
if (rule.type === 'import') {

@@ -91,11 +90,11 @@ //

var importRegEx = /(url)?\s*(('([^']*)'|"([^"]*)")|\(('([^']*)'|"([^"]*)"|([^\)]*))\))\s*;?/;
var result = importRegEx.exec(rule.import);
var result = importRegEx.exec(rule['import']);
// rule.import result array
// =======================================
var url = result[7] // url('path/to/foo.css') result[7] = path/to/foo.css
|| result[8] // url("path/to/foo.css") result[8] = path/to/foo.css
|| result[9] // url(path/to/foo.css) result[9] = path/to/foo.css
|| result[4] // 'path/to/foo.css' result[4] = path/to/foo.css
|| result[5]; // "path/to/foo.css" result[5] = path/to/foo.css
// rule.import result array
// =======================================
var url = result[7] || // url('path/to/foo.css') result[7] = path/to/foo.css
result[8] || // url("path/to/foo.css") result[8] = path/to/foo.css
result[9] || // url(path/to/foo.css) result[9] = path/to/foo.css
result[4] || // 'path/to/foo.css' result[4] = path/to/foo.css
result[5]; // "path/to/foo.css" result[5] = path/to/foo.css

@@ -125,3 +124,3 @@ url = _str.trim(url);

var result = css.stringify({
var css = css.stringify({
stylesheet: {

@@ -131,4 +130,3 @@ rules: [ rule ]

});
cssStream.write(result + '\n');
cssStream.write(css + '\n');
}

@@ -135,0 +133,0 @@ });

@@ -22,11 +22,11 @@ 'use strict';

var pkg = JSON.parse(fs.readFileSync(process.cwd() + '/package.json') || '{}');
var options = pkg['browserify-css'] || {};
if (typeof options === 'string') {
var base = path.relative(__dirname, process.cwd());
try {
try {
var pkg = JSON.parse(fs.readFileSync(process.cwd() + '/package.json') || '{}');
var options = pkg['browserify-css'] || defaults;
if (typeof options === 'string') {
var base = path.relative(__dirname, process.cwd());
options = require(path.join(base, options)) || defaults;
} catch (err) {
options = defaults;
}
} catch (err) {
options = defaults;
}

@@ -65,8 +65,8 @@ options = _.defaults(options, defaults);

if ( ! options['autoInject']) {
moduleBody = 'module.exports = ' + JSON.stringify(data) + ';'
moduleBody = 'module.exports = ' + JSON.stringify(data) + ';';
} else {
if (options.autoInjectOptions['verbose']) {
moduleBody = 'var css = ' + JSON.stringify(data) + '; (require(' + JSON.stringify(__dirname) + ').createStyle(css, { "href": ' + JSON.stringify(href) + '})); module.exports = css;'
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;'
moduleBody = 'var css = ' + JSON.stringify(data) + '; (require(' + JSON.stringify(__dirname) + ').createStyle(css)); module.exports = css;';
}

@@ -73,0 +73,0 @@ }

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

@@ -8,3 +8,5 @@ "main": "./index.js",

"scripts": {
"test": "mocha"
"test": "npm run gulp",
"gulp": "gulp",
"tap-test": "tap test/*.js"
},

@@ -37,3 +39,7 @@ "repository": {

"devDependencies": {
"browserify": "6.3.x"
"browserify": "^8.1.3",
"gulp": "^3.8.11",
"gulp-jshint": "^1.9.2",
"jsdom": "^3.1.1",
"tap": "^0.6.0"
},

@@ -40,0 +46,0 @@ "bugs": {

@@ -1,3 +0,5 @@

# browserify-css #
# browserify-css [![build status](https://secure.travis-ci.org/cheton/browserify-css.png?branch=master)](https://travis-ci.org/cheton/browserify-css)
[![NPM](https://nodei.co/npm/browserify-css.png?downloads=true&stars=true)](https://nodei.co/npm/browserify-css/)
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.

@@ -4,0 +6,0 @@

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