postcss-less-parser
Advanced tools
Comparing version 0.0.1 to 0.0.2
{ | ||
"name": "postcss-less-parser", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "PostCSS plugin for integrating the popular Less CSS pre-processor into your PostCSS workflow", | ||
@@ -12,9 +12,9 @@ "keywords": [ | ||
], | ||
"author": "Matthew Dean <matthewdean.me@gmail.com>", | ||
"author": "Matthew Dean <hello@getcrunch.co>", | ||
"license": "MIT", | ||
"repository": "matthew-dean/postcss-less-parser", | ||
"repository": "Crunch/postcss-less", | ||
"bugs": { | ||
"url": "https://github.com/matthew-dean/postcss-less-parser/issues" | ||
"url": "https://github.com/Crunch/postcss-less/issues" | ||
}, | ||
"homepage": "https://github.com/matthew-dean/postcss-less-parser", | ||
"homepage": "https://github.com/Crunch/postcss-less", | ||
"dependencies": {}, | ||
@@ -29,4 +29,4 @@ "devDependencies": { | ||
"scripts": { | ||
"test": "ava && eslint *.js" | ||
"test": "gulp test" | ||
} | ||
} |
@@ -1,10 +0,19 @@ | ||
# Less for PostCSS [![Build Status][ci-img]][ci] | ||
# Finally, Less comes to PostCSS | ||
[PostCSS] plugin for integrating the popular Less CSS pre-processor into your PostCSS workflow. | ||
[![Build Status][ci-img]][ci] | ||
WIP - If anyone wants to help me get this working (especially tests, which haven't worked yet because of the async flow), that would be great. Pull requests welcome. | ||
What you've been waiting for: a [PostCSS] custom parser plugin for integrating the popular Less CSS pre-processor into your PostCSS workflow! It integrates the entire Less engine, evaluates your `.less`, and exports a PostCSS AST that you can use to attach multiple subsequent PostCSS plugins. | ||
Instead of trying to assemble a hodge-podge collection of PostCSS plugins that "emulate" a pre-processor, use a pre-processor! | ||
## Some caveats | ||
Because this uses the Less.js parser and not the default PostCSS processor, some parsing will be different. PostCSS accepts "broken" CSS, whereas Less doubles as a de facto CSS linter, and will return errors if your Less / CSS is poorly structured. | ||
PostCSS will also sometimes "fix" CSS that uses property hacks, which Less preserves as the property name, or will remove comments from within values, which are also kept in the value by Less. | ||
[PostCSS]: https://github.com/postcss/postcss | ||
[ci-img]: https://travis-ci.org/matthew-dean/postcss-less.svg | ||
[ci]: https://travis-ci.org/matthew-dean/postcss-less | ||
[ci-img]: https://travis-ci.org/Crunch/postcss-less.svg | ||
[ci]: https://travis-ci.org/Crunch/postcss-less | ||
[postcss-less-parser]: https://github.com/Crunch/postcss-less-parser | ||
@@ -14,8 +23,8 @@ | ||
Follow these simple steps to use [postcss-less]. | ||
Follow these simple steps to use [postcss-less-parser]. | ||
Add [postcss-less] to your build tool: | ||
Add [postcss-less-parser] to your build tool: | ||
```bash | ||
npm install postcss-less --save-dev | ||
npm install postcss-less-parser --save-dev | ||
``` | ||
@@ -26,4 +35,4 @@ | ||
```js | ||
var less = require('postcss-less'); | ||
less({ /* options */ }).process(YOUR_CSS, { parser: less }); | ||
var less = require('postcss-less-parser'); | ||
less({ /* Less.js options */ }).process(YOUR_CSS, { parser: less.parser }); | ||
``` | ||
@@ -34,6 +43,6 @@ | ||
```js | ||
var less = require('postcss-less'); | ||
var less = require('postcss-less-parser'); | ||
postcss([ | ||
less({ /* options */ }) | ||
]).process(YOUR_CSS, { parser: less }).then(function (result) { | ||
less({ /* Less.js options */ }) | ||
]).process(YOUR_CSS, { parser: less.parser }).then(function (result) { | ||
// do something with result.css | ||
@@ -51,3 +60,3 @@ }); | ||
Enable [postcss-less] within your Gulpfile: | ||
Enable [postcss-less-parser] within your Gulpfile: | ||
@@ -60,3 +69,3 @@ ```js | ||
postcss([ | ||
require('postcss-less')({ /* options */ }) | ||
require('postcss-less-parser')({ /* Less.js options */ }) | ||
]) | ||
@@ -74,6 +83,6 @@ ).pipe( | ||
```sh | ||
npm install postcss-less --save-dev | ||
npm install postcss-less-parser --save-dev | ||
``` | ||
Enable [postcss-less] within your Gruntfile: | ||
Enable [postcss-less-parser] within your Gruntfile: | ||
@@ -86,5 +95,5 @@ ```js | ||
options: { | ||
parser: require('postcss-less'), | ||
parser: require('postcss-less-parser'), | ||
processors: [ | ||
require('postcss-less')({ /* options */ }) | ||
require('postcss-less-parser')({ /* Less.js options */ }) | ||
] | ||
@@ -91,0 +100,0 @@ }, |
21
test.js
@@ -1,20 +0,1 @@ | ||
import postcss from 'postcss'; | ||
import test from 'ava'; | ||
import plugin from './'; | ||
function run(t, input, output, opts = { }) { | ||
return postcss([ plugin(opts) ]).process(input) | ||
.then( result => { | ||
t.same(result.css, output); | ||
t.same(result.warnings().length, 0); | ||
}); | ||
} | ||
/* Write tests here | ||
test('does something', t => { | ||
return run(t, 'a{ }', 'a{ }', { }); | ||
}); | ||
*/ | ||
require('./test/parse') |
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
19604
100
292