Skip to content

Commit 2854f4f

Browse files
author
Francis Saul
committed
Initial commit
0 parents  commit 2854f4f

14 files changed

+277
-0
lines changed

.babelrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"presets": ["es2015-loose", "stage-0"],
3+
"plugins": ["add-module-exports", "precompile-charcodes"]
4+
}

.editorconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 4
6+
end_of_line = lf
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true
10+
11+
[*.{json,yml}]
12+
indent_size = 2

.eslintrc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"parser": "babel-eslint",
3+
"extends": "eslint-config-postcss",
4+
"rules": {
5+
"key-spacing": [2, { "align": "value" }],
6+
"complexity": [0]
7+
},
8+
"env": {
9+
"mocha": true
10+
}
11+
}

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.DS_Store
2+
*~
3+
4+
node_modules/
5+
npm-debug.log
6+
7+
build/

.npmignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.gitignore
2+
3+
node_modules/
4+
npm-debug.log
5+
6+
build/
7+
8+
test/
9+
.travis.yml
10+
11+
gulpfile.babel.js

.travis.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
sudo: false
2+
language: node_js
3+
node_js:
4+
- "5"
5+
- "4"
6+
- "0.12"

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
## 0.1
2+
* Initial release.

LICENSE

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
The MIT License (MIT)
2+
3+
Copyright 2013 Francis Saul <[email protected]>
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.

README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# PostCSS strip inline comments [![Build Status][ci-img]][ci]
2+
3+
<img align="right" width="95" height="95"
4+
title="Philosopher’s stone, logo of PostCSS"
5+
src="http://postcss.github.io/postcss/logo.svg">
6+
7+
A plugin to remove inline CSS comments from compilation.
8+
9+
```css
10+
/* This comment will remain */
11+
// This comment will be removed
12+
body {
13+
// This comment will also be removed
14+
background-color: black;
15+
}
16+
// And so will this one
17+
```
18+
19+
## Usage
20+
21+
You need to have [postcss-scss](https://github.com/postcss/postcss-scss) parser already parsing your postcss for this plugin to work.
22+
23+
```npm install postcss-strip-inline-comments --save-dev```
24+
25+
###Grunt
26+
27+
```javascript
28+
29+
```
30+
31+
###Gulp
32+
33+
```javascript
34+
35+
```
36+
37+
###Webpack
38+
39+
```javascript
40+
41+
```

gulpfile.babel.js

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
import gulp from 'gulp';
2+
3+
gulp.task('clean', () => {
4+
let del = require('del');
5+
return del(['build/']);
6+
});
7+
8+
// Build
9+
10+
gulp.task('build:lib', ['clean'], () => {
11+
let babel = require('gulp-babel');
12+
return gulp.src('lib/*.es6')
13+
.pipe(babel())
14+
.pipe(gulp.dest('build/lib'));
15+
});
16+
17+
gulp.task('build:docs', ['clean'], () => {
18+
let ignore = require('fs').readFileSync('.npmignore').toString()
19+
.trim().split(/\n+/)
20+
.concat(['.npmignore', 'package.json', 'index.js'])
21+
.map( i => '!' + i );
22+
return gulp.src(['*'].concat(ignore))
23+
.pipe(gulp.dest('build'));
24+
});
25+
26+
gulp.task('build:package', ['clean'], () => {
27+
let editor = require('gulp-json-editor');
28+
gulp.src('./package.json')
29+
.pipe(editor( json => {
30+
json.main = 'lib/strip-inline-comments';
31+
for ( let i in json.dependencies ) {
32+
if ( /^babel-/.test(i) ) {
33+
json.devDependencies[i] = json.dependencies[i];
34+
delete json.dependencies[i];
35+
}
36+
}
37+
return json;
38+
}))
39+
.pipe(gulp.dest('build'));
40+
});
41+
42+
gulp.task('build', ['build:lib', 'build:docs', 'build:package']);
43+
44+
// Lint
45+
46+
gulp.task('lint', () => {
47+
let eslint = require('gulp-eslint');
48+
return gulp.src(['*.js', 'lib/*.es6', 'test/*.es6'])
49+
.pipe(eslint())
50+
.pipe(eslint.format())
51+
.pipe(eslint.failAfterError());
52+
});
53+
54+
// Test
55+
56+
gulp.task('test', () => {
57+
require('babel-core/register')({ extensions: ['.es6'], ignore: false });
58+
let mocha = require('gulp-mocha');
59+
return gulp.src('test/*.es6', { read: false }).pipe(mocha());
60+
});
61+
62+
gulp.task('integration', done => {
63+
require('babel-core/register')({ extensions: ['.es6'], ignore: false });
64+
let postcss = require('postcss');
65+
let real = require('postcss-parser-tests/real');
66+
let scss = require('postcss-scss');
67+
real(done, css => {
68+
return postcss().process(css, {
69+
parser: scss,
70+
map: { annotation: false }
71+
});
72+
});
73+
});
74+
75+
// Common
76+
77+
gulp.task('default', ['lint', 'test']);

0 commit comments

Comments
 (0)