├── .gitignore ├── .travis.yml ├── LICENSE ├── README.md ├── index.js ├── package-lock.json ├── package.json └── test ├── app ├── debug.js ├── package.json └── test.html ├── colors.less ├── error.js ├── nonsense.less ├── styles.css ├── styles.less ├── test.html └── test.js /.gitignore: -------------------------------------------------------------------------------- 1 | lib-cov 2 | *.seed 3 | *.log 4 | *.csv 5 | *.dat 6 | *.out 7 | *.pid 8 | *.gz 9 | 10 | .DS_Store 11 | 12 | pids 13 | logs 14 | results 15 | 16 | npm-debug.log 17 | node_modules 18 | 19 | test/bundle.js 20 | test/app/script.js -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "6" 4 | - "7" 5 | - "8" 6 | notifications: 7 | email: false -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013 Chris Wilson 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | node-lessify 2 | ============ 3 | Version 0.2.0 4 | 5 | [![Build Status](https://travis-ci.org/wilson428/node-lessify.png)](https://travis-ci.org/wilson428/node-lessify) 6 | [![Dependency Status](https://david-dm.org/wilson428/node-lessify.svg)](https://david-dm.org/wilson428/node-lessify) 7 | [![devDependencies](https://david-dm.org/wilson428/node-lessify/dev-status.svg)](https://david-dm.org/wilson428/node-lessify#info=devDependencies) 8 | 9 | LESS 3.12 precompiler and CSS plugin for Browserify. Inspired by [node-underscorify](https://github.com/maxparm/node-underscorify). Originally developed for TIME Magazine's [interactive deployment framework](https://github.com/TimeMagazine/time-interactive). 10 | 11 | When bundling an app using [Browserify](http://browserify.org/), it's often convenient to be able to include your CSS as a script that appends the style declarations to the head. This is particularly relevant for self-assembling apps that attach themselves to a page but otherwise have reserved real-estate on the DOM. 12 | 13 | This small script allows you to `require()` your CSS or LESS files as you would any other script. 14 | 15 | ## Installation 16 | 17 | ``` 18 | npm install node-lessify 19 | ``` 20 | 21 | ## Usage 22 | Write your LESS or CSS files as you normally would, and put them somewhere where your script can find it. 23 | 24 | Then simply require them as you might anything else: 25 | 26 | ``` 27 | require('./styles.less'); 28 | require('./mysite.css'); 29 | ``` 30 | 31 | To compile the stylesheets, pass this module to browserify as a transformation on the command line. 32 | 33 | ``` 34 | browserify -t node-lessify script.js > bundle.js 35 | ``` 36 | 37 | ## How it works 38 | 39 | The stylesheets are compiled (in the case of LESS), minified, and bundle into a function that creates a new `