browserify-css
Advanced tools
Comparing version 0.4.0 to 0.4.1
@@ -29,3 +29,2 @@ 'use strict'; | ||
style.type = 'text/css'; | ||
style.innerHTML = cssText; | ||
@@ -39,13 +38,16 @@ for (var key in attributes) { | ||
} | ||
if (style.sheet) { | ||
if (style.sheet) { // for IE9+ | ||
style.innerHTML = cssText; | ||
style.sheet.cssText = cssText; | ||
} else if (style.styleSheet) { | ||
head.appendChild(style); | ||
} else if (style.styleSheet) { // for IE8 | ||
head.appendChild(style); | ||
style.styleSheet.cssText = cssText; | ||
} else { | ||
style.innerHTML = cssText; | ||
style.appendChild(document.createTextNode(cssText)); | ||
head.appendChild(style); | ||
} | ||
head.appendChild(style); | ||
} | ||
}; |
{ | ||
"name": "browserify-css", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"description": "A Browserify transform for bundling, rebasing, inlining, and minifying CSS files", | ||
@@ -47,3 +47,3 @@ "main": "./index.js", | ||
}, | ||
"homepage": "https://github.com/cheton/browserify-css" | ||
"homepage": "http://cheton.github.io/browserify-css/" | ||
} |
@@ -1,2 +0,2 @@ | ||
# browserify-css [![build status](https://travis-ci.org/cheton/browserify-css.svg?branch=master)](https://travis-ci.org/cheton/browserify-css) | ||
# browserify-css [![build status](https://travis-ci.org/cheton/browserify-css.svg?branch=master)](https://travis-ci.org/cheton/browserify-css) [![Coverage Status](https://coveralls.io/repos/cheton/browserify-css/badge.svg)](https://coveralls.io/r/cheton/browserify-css) | ||
@@ -100,3 +100,3 @@ [![NPM](https://nodei.co/npm/browserify-css.png?downloads=true&stars=true)](https://nodei.co/npm/browserify-css/) | ||
{ | ||
verbose: true | ||
"verbose": true | ||
} | ||
@@ -126,4 +126,58 @@ ``` | ||
## FAQ | ||
### How do I include CSS files located inside the node_modules folder? | ||
You can choose one of the following methods to include CSS files located inside the node_modules folder: | ||
1. The easiest way to do this is using the `@import` rule. For example: | ||
app.js: | ||
``` javascript | ||
require('./app.css'); | ||
``` | ||
app.css: | ||
``` css | ||
/* Use CSS from your node_modules folder */ | ||
@import "node_modules/foo/foo.css"; | ||
/* Or your own relative files */ | ||
@import "styles/common.css"; | ||
``` | ||
2. Use the global transform option (i.e. `--global-transform` or `-g`) on the command line to transform all files in a node_modules directory: | ||
``` bash | ||
$ browserify -g browserify-css app.js > bundle.js | ||
``` | ||
or use the API directly: | ||
``` js | ||
var browserify = require('browserify'); | ||
var b = browserify('./app.js'); | ||
b.transform('browserify-css', {global: true}); | ||
b.bundle().pipe(process.stdout); | ||
``` | ||
See [browserify transform options](https://github.com/substack/node-browserify#btransformtr-opts) for details. | ||
3. Put browserify transform option into a submodule's package.json file inside the `node_modules` directory on a **per-module basis** like so: | ||
node_modules/foo/package.json: | ||
``` json | ||
{ | ||
"browserify": { | ||
"transform": ["browserify-css"] | ||
} | ||
} | ||
``` | ||
Then, run browserify transform on the command line: | ||
``` bash | ||
$ browserify -t browserify-css app.js > bundle.js | ||
``` | ||
## License | ||
MIT | ||
Copyright (c) 2014-2015 Cheton Wu | ||
Licensed under the [MIT License](https://github.com/cheton/browserify-css/blob/master/LICENSE). |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
285316
25
8404
182
0
8