diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..4a7ea30 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +root = true + +[*] +indent_style = space +indent_size = 2 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.md] +trim_trailing_whitespace = false diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..176a458 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +* text=auto diff --git a/.npmignore b/.npmignore deleted file mode 100644 index 1aa2d59..0000000 --- a/.npmignore +++ /dev/null @@ -1,8 +0,0 @@ -.gitignore - -node_modules/ - -test/ -.travis.yml - -gulpfile.js diff --git a/gulpfile.js b/gulpfile.js deleted file mode 100644 index 888b8b0..0000000 --- a/gulpfile.js +++ /dev/null @@ -1,16 +0,0 @@ -var gulp = require('gulp'); - -gulp.task('lint', function () { - var eslint = require('gulp-eslint'); - return gulp.src(['index.js', 'test/*.js', 'gulpfile.js']) - .pipe(eslint()) - .pipe(eslint.format()) - .pipe(eslint.failAfterError()); -}); - -gulp.task('test', function () { - var mocha = require('gulp-mocha'); - return gulp.src('test/*.js', { read: false }).pipe(mocha()); -}); - -gulp.task('default', ['lint', 'test']); diff --git a/index.js b/index.js index 4ecfc16..8a08db4 100644 --- a/index.js +++ b/index.js @@ -3,7 +3,7 @@ var postcss = require('postcss'); module.exports = postcss.plugin('mahogany', function () { return function (css) { css.walkDecls(function (decl) { - decl.important = true; + decl.important = true; }); }; }); diff --git a/package.json b/package.json index 8221edb..4a86caf 100644 --- a/package.json +++ b/package.json @@ -2,27 +2,33 @@ "name": "mahogany", "version": "0.0.2", "description": "PostCSS plugin that lets everyone know how important your CSS is", + "license": "MIT", + "repository": "conceptualitis/mahogany", + "author": "Neil Duffy ", + "engines": { + "node": ">=0.12.0" + }, "keywords": [ + "postcss-plugin", "postcss", "css", - "postcssplugin", "important" ], - "author": "Neil Duffy ", - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/conceptualitis/mahogany.git" + "scripts": { + "pretest": "xo", + "test": "ava" }, + "files": [ + "index.js" + ], "dependencies": { "postcss": "^5.0.16" }, "devDependencies": { - "gulp-mocha": "2.0.1", - "chai": "2.2.0", - "gulp": "3.8.11" + "ava": "^0.12.0", + "xo": "^0.12.1" }, - "scripts": { - "test": "gulp test" + "xo": { + "space": 2 } } diff --git a/test.js b/test.js new file mode 100644 index 0000000..54081f6 --- /dev/null +++ b/test.js @@ -0,0 +1,18 @@ +import test from 'ava'; +import mahogany from './'; + +function run(input, output, t) { + t.is(mahogany.process(input).css, output); +} + +test('much transform, very important', t => run( + 'a { color: red; font-size: 12px; } b { font-weight: 400; }', + 'a { color: red !important; font-size: 12px !important; } b { font-weight: 400 !important; }', + t +)); + +test('much transform, too much important', t => run( + 'a { color: red !important; } b { font-weight: 400; }', + 'a { color: red !important; } b { font-weight: 400 !important; }', + t +)); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 290e427..0000000 --- a/test/test.js +++ /dev/null @@ -1,23 +0,0 @@ -var postcss = require('postcss'); -var expect = require('chai').expect; - -var plugin = require('../'); - -var test = function (input, output, done) { - postcss([ plugin() ]).process(input).then(function (result) { - expect(result.css).to.eql(output); - done(); - }); -}; - -describe('mahogany', function () { - it('much transform, very important', function (done) { - test('a { color: red; font-size: 12px; } b { font-weight: 400; }', - 'a { color: red !important; font-size: 12px !important; } b { font-weight: 400 !important; }', done); - }); - - it('much transform, too much important', function (done) { - test('a { color: red !important; } b { font-weight: 400; }', - 'a { color: red !important; } b { font-weight: 400 !important; }', done); - }); -});