https://github.com/capaj/require-stylify
require styles in your browserify builds, same as you require your js files, works with css, less and sass
https://github.com/capaj/require-stylify
Last synced: about 1 year ago
JSON representation
require styles in your browserify builds, same as you require your js files, works with css, less and sass
- Host: GitHub
- URL: https://github.com/capaj/require-stylify
- Owner: capaj
- License: mit
- Created: 2014-09-23T16:03:20.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2016-08-24T22:20:35.000Z (almost 10 years ago)
- Last Synced: 2025-04-15T06:17:11.183Z (about 1 year ago)
- Language: JavaScript
- Size: 24.4 KB
- Stars: 7
- Watchers: 2
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
require-stylify
===============
This package is DEPRECATED. Find packages for styles under active development [here](https://github.com/substack/node-browserify/wiki/list-of-transforms).
require styles in your browserify builds, same as you require your js files:
```javascript
require('./less/main.less');
require('./sass/sassFile.scss');
```
This will get transformed into:
```javascript
appendStyle('/less/main.css'); //and it will compile the required less file into this css obviously
appendStyle('/sass/sassFile.css'); //and it will compile the required sass file into this css obviously
```
appendStyle global is defined in [https://github.com/capaj/require-stylify/blob/master/append-stylesheet.js](https://github.com/capaj/require-stylify/blob/master/append-stylesheet.js)
Should work with css, less and sass(only scss files are supported though).
### why use this rather than [node-lessify](https://github.com/wilson428/node-lessify)
Because this creates a css file on your filesystem and it appends style element with href rather than just appending styles directly into your html. This is better, because your generated less/sass sourcemaps still work. Also I believe having separate CSS and JS is good thing even though you end up with one extra file(your main.less/main.sass). I personally don't change css styles as often as JS files, so when you have live web app with caching, with most new builds, users download only JS bundle and their old cached CSS doesn't need to be reloaded from the server.