Skip to content

Commit 9ef9dd2

Browse files
committed
init
0 parents  commit 9ef9dd2

File tree

9 files changed

+171
-0
lines changed

9 files changed

+171
-0
lines changed

.gitignore

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Logs
2+
logs
3+
*.log
4+
5+
# Runtime data
6+
pids
7+
*.pid
8+
*.seed
9+
10+
# Directory for instrumented libs generated by jscoverage/JSCover
11+
lib-cov
12+
13+
# Coverage directory used by tools like istanbul
14+
coverage
15+
16+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
17+
.grunt
18+
19+
# node-waf configuration
20+
.lock-wscript
21+
22+
# Compiled binary addons (http://nodejs.org/api/addons.html)
23+
build/Release
24+
25+
# Dependency directory
26+
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
27+
node_modules
28+
package-lock.json

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package-lock=false

.travis.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
language: node_js
2+
node_js:
3+
- 'stable'
4+
- '8'
5+
- '6'

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# sheetify-check change log
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
This project adheres to [Semantic Versioning](http://semver.org/).

LICENSE.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# [Apache License 2.0](https://spdx.org/licenses/Apache-2.0)
2+
3+
Copyright 2018 Renée Kooi <[email protected]>
4+
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
> http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.

README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# sheetify-check
2+
3+
check css syntax with sheetify
4+
5+
[![npm][npm-image]][npm-url]
6+
[![travis][travis-image]][travis-url]
7+
[![standard][standard-image]][standard-url]
8+
9+
[npm-image]: https://img.shields.io/npm/v/sheetify-check.svg?style=flat-square
10+
[npm-url]: https://www.npmjs.com/package/sheetify-check
11+
[travis-image]: https://img.shields.io/travis/goto-bus-stop/sheetify-check.svg?style=flat-square
12+
[travis-url]: https://travis-ci.org/goto-bus-stop/sheetify-check
13+
[standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square
14+
[standard-url]: http://npm.im/standard
15+
16+
## Install
17+
18+
```
19+
npm install sheetify-check
20+
```
21+
22+
## Usage
23+
24+
Configured via package.json:
25+
26+
```js
27+
{
28+
"sheetify": {
29+
"transform": [
30+
"sheetify-check"
31+
]
32+
}
33+
}
34+
```
35+
36+
Configured via the Browserify API:
37+
38+
```js
39+
b.transform(sheetify, {
40+
transform: ['sheetify-check']
41+
})
42+
```
43+
44+
## License
45+
46+
[Apache-2.0](LICENSE.md)

index.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
var parse = require('css').parse
2+
3+
module.exports = function sheetifyCheck (filename, css, opts, cb) {
4+
try {
5+
parse(css, { source: filename })
6+
} catch (err) {
7+
return cb(err)
8+
}
9+
cb(null, css)
10+
}

package.json

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"name": "sheetify-check",
3+
"description": "check css syntax with sheetify",
4+
"version": "0.0.0",
5+
"author": "Renée Kooi <[email protected]>",
6+
"bugs": {
7+
"url": "https://github.com/stackcss/sheetify-check/issues"
8+
},
9+
"devDependencies": {
10+
"sheetify": "^7.3.2",
11+
"standard": "*",
12+
"tap-spec": "^4.0.2",
13+
"tape": "^4.0.0"
14+
},
15+
"homepage": "https://github.com/stackcss/sheetify-check",
16+
"keywords": [
17+
"check",
18+
"css",
19+
"parse",
20+
"sheetify",
21+
"syntax"
22+
],
23+
"license": "Apache-2.0",
24+
"main": "index.js",
25+
"repository": {
26+
"type": "git",
27+
"url": "https://github.com/stackcss/sheetify-check.git"
28+
},
29+
"scripts": {
30+
"test": "standard && tape test/*.js | tap-spec"
31+
},
32+
"dependencies": {
33+
"css": "^2.2.1"
34+
}
35+
}

test/index.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
var test = require('tape')
2+
var sheetify = require('sheetify')
3+
4+
var check = require.resolve('../')
5+
6+
test('accepts valid input', function (t) {
7+
t.plan(2)
8+
var src = '.a { color: red }'
9+
sheetify(src, 'style.css', {
10+
transform: [check]
11+
}, function (err, res) {
12+
t.ifError(err)
13+
t.equal(src, res.css)
14+
})
15+
})
16+
17+
test('rejects invalid input', function (t) {
18+
t.plan(2)
19+
var src = '.a { color red }'
20+
sheetify(src, 'style.css', {
21+
transform: [check]
22+
}, function (err) {
23+
t.ok(err)
24+
t.equal(err.reason, 'property missing \':\'')
25+
})
26+
})

0 commit comments

Comments
 (0)