Launch Week Day 2: Introducing Reports: An Extensible Reporting Framework for Socket Data.Learn More
Socket
Book a DemoSign in
Socket

sheetify

Package Overview
Dependencies
Maintainers
2
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sheetify - npm Package Compare versions

Comparing version
2.0.0
to
2.0.3
+7
.travis.yml
node_js:
- "2"
- "3"
sudo: false
language: node_js
script: "npm run test:cov"
after_script: "npm i -g codecov.io && cat ./coverage/lcov.info | codecov"
#!/usr/bin/env node
const cliclopts = require('cliclopts')
const minimist = require('minimist')
const fs = require('fs')
const main = require('../')
const opts = cliclopts([
{ name: 'help', abbr: 'h', boolean: true },
{ name: 'version', abbr: 'v', boolean: true },
{ name: 'compress', abbr: 'c', boolean: true },
{ name: 'debug', abbr: 'd', boolean: true },
{ name: 'transform', abbr: 't' }
])
const argv = minimist(process.argv.slice(2), opts.options())
const files = argv._.map(function (file) {
const entry = String(file)
return /^\.\//g.test(entry) ? entry : './' + entry
})
// parse options
if (argv.version) {
const version = require('../package.json').version
process.stdout.write('v' + version)
process.exit(0)
}
else if (argv.help) usage(0)
else if (!files.length) usage(1)
else {
const bundler = main(files[0])
const transforms = toArray(argv.transform)
transforms.forEach(function (tr) {
bundler.transform(tr)
})
bundler.bundle(argv, function (err, data) {
if (err) throw err
process.stdout.write(data)
process.stdout.write('\n')
})
}
// print usage & exit
// num? -> null
function usage (exitCode) {
fs.createReadStream(__dirname + '/usage.txt')
.pipe(process.stdout)
.on('close', process.exit.bind(null, exitCode))
}
// transform a value to an array
// [any]|any -> [any]
function toArray (val) {
if (!val) return []
return Array.isArray(val) ? val : [val]
}
sheetify - Modular CSS bundler
Usage: sheetify [options] [entry file]
Options:
-h, --help Output usage information
-v, --version Output version number
-t, --transform Include a sheetify transform
-m, --modifier Include a sheetify modifier
-c, --compress Compress final output
-d, --debug Inline CSS sourcemaps
Examples:
$ sheetify index.css > bundle.css # Bundle index.css to bundle.css
$ sheetify -cd index.css # Compress and include source maps
Docs: https://github.com/sheetify/sheetify
Bugs: https://github.com/sheetify/sheetify/issues
const styledeps = require('style-deps')
const assert = require('assert')
const xtend = require('xtend')
const noop = require('noop2')
module.exports = Sheetify
function Sheetify (entry) {
if (!(this instanceof Sheetify)) return new Sheetify(entry)
assert.equal(typeof entry, 'string')
this.transforms = []
this.entry = entry
return this
}
Sheetify.prototype.transform = function (transform) {
this.transforms.push(transform)
return this
}
Sheetify.prototype.bundle = function (opts, done) {
if (!done) {
done = opts
opts = {}
}
done = done || noop
assert.equal(typeof opts, 'object')
assert.equal(typeof done, 'function')
const base = {
transforms: this.transforms,
modifiers: this.modifiers
}
return styledeps(this.entry, xtend(opts, base), done)
}
The MIT License (MIT)
Copyright (c) 2015 Team Sheetify
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+31
-13
{
"name": "sheetify",
"version": "2.0.0",
"description": "",
"main": "sheetify.js",
"version": "2.0.3",
"description": "Modular CSS bundler",
"scripts": {
"test": "faucet test/*.js"
"deps": "dependency-check . && dependency-check . --extra --no-dev",
"deps:pkg": "ncu",
"deps:update": "ncu -a",
"test": "standard && npm run deps && faucet test/*.js",
"test:cov": "standard && npm run deps && NODE_ENV=test istanbul cover test/index.js",
"format": "standard --format"
},
"author": "",
"bin": {
"sheetify": "bin.js"
"sheetify": "bin/cli.js"
},
"repository": "sheetify/sheetify",
"keywords": [
"modular",
"css",
"bundle",
"browserify",
"css-modules"
],
"license": "MIT",
"dependencies": {
"once": "~1.3.0",
"cliclopts": "^1.1.1",
"minimist": "^1.2.0",
"noop2": "^2.0.0",
"style-deps": "^2.0.1",
"style-resolve": "0.0.0",
"subarg": "0.0.1",
"xtend": "~2.1.2"
"xtend": "^4.0.0"
},
"devDependencies": {
"tape": "~2.4.2",
"wrap-selectors": "~0.1.0",
"faucet": "0.0.1"
"concat-stream": "^1.5.0",
"dependency-check": "^2.5.0",
"faucet": "^0.0.1",
"istanbul": "^0.3.19",
"npm-check-updates": "^2.2.0",
"standard": "^5.2.1",
"tape": "^4.2.0",
"through2": "^2.0.0",
"wrap-selectors": "^0.1.0"
}
}
+80
-12

@@ -1,20 +0,88 @@

# sheetify #
# sheetify
<img
alt="sheetify logo"
height="100"
style="max-width: 100%"
data-canonical-src="https://github.com/sheetify/logo"
src="https://raw.githubusercontent.com/sheetify/logo/master/512v6.png">
A module bundler for CSS that works with [npm](http://npmjs.org/) modules
like [browserify](http://browserify.org/) does – including sourcemap support!
[![NPM version][npm-image]][npm-url]
[![build status][travis-image]][travis-url]
[![Test coverage][codecov-image]][codecov-url]
[![Downloads][downloads-image]][downloads-url]
[![js-standard-style][standard-image]][standard-url]
## Command-Line Usage ##
Modular CSS bundler. Works with [npm](http://npmjs.org/) modules like
[browserify](http://browserify.org/) does.
``` bash
Usage:
__Features__
- source map support
- minification
- rich plugin ecosystem
- streaming interface
- easily extensible
sheetify [entry file] {OPTIONS}
## Usage
__cli__
```txt
sheetify - Modular CSS bundler
Usage: sheetify [options] [entry file]
Options:
-h, --help Output usage information
-v, --version Output version number
-t, --transform Include a sheetify transform
-m, --modifier Include a sheetify modifier
-c, --compress Compress final output
-d, --debug Inline CSS sourcemaps
--transform, -t Include a sheetify transform.
--modifier, -m Include a sheetify modifier.
--compress, -c Compress final output.
--version, -v Output version information and quit.
--debug, -d Inline CSS sourcemaps to final output.
Examples:
$ sheetify index.css > bundle.css # Bundle index.css to bundle.css
$ sheetify -cd index.css # Compress and include source maps
Docs: https://github.com/sheetify/sheetify
Bugs: https://github.com/sheetify/sheetify/issues
```
__api__
```js
const sheetify = require('sheetify')
const bundler = sheetify('./index.css')
bundler.bundle().pipe(process.stdout)
```
## Options
### transform
[tbi]
### modifier
[tbi]
### compress
[tbi]
### debug
[tbi]
## API
### bundler = sheetify(entry)
[tbi]
### bundler.bundle(cb(err, res))
[tbi]
## License
[MIT](https://tldrlegal.com/license/mit-license)
[npm-image]: https://img.shields.io/npm/v/sheetify.svg?style=flat-square
[npm-url]: https://npmjs.org/package/sheetify
[travis-image]: https://img.shields.io/travis/sheetify/sheetify/master.svg?style=flat-square
[travis-url]: https://travis-ci.org/sheetify/sheetify
[codecov-image]: https://img.shields.io/codecov/c/github/sheetify/sheetify/master.svg?style=flat-square
[codecov-url]: https://codecov.io/github/sheetify/sheetify
[downloads-image]: http://img.shields.io/npm/dm/sheetify.svg?style=flat-square
[downloads-url]: https://npmjs.org/package/sheetify
[standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square
[standard-url]: https://github.com/feross/standard

@@ -1,15 +0,12 @@

var test = require('tape')
var exec = require('child_process').exec
var fs = require('fs')
const exec = require('child_process').exec
const test = require('tape')
const fs = require('fs')
var BIN = require.resolve('../bin.js')
const BIN = require.resolve('../bin/cli.js')
const expected = fs.readFileSync(__dirname + '/concat-expected.css', 'utf8')
var expected = fs.readFileSync(__dirname + '/concat-expected.css', 'utf8')
test('works', function(t) {
test('works', function (t) {
t.plan(2)
exec(BIN + ' concat.css', {
cwd: __dirname
}, function(err, stdout, stderr) {
const opts = { cwd: __dirname }
exec(BIN + ' concat.css', opts, function (err, stdout, stderr) {
t.ifError(err)

@@ -16,0 +13,0 @@ t.equal(stdout.trim(), expected.trim())

@@ -1,5 +0,5 @@

module.exports = function(file) {
return function(style, next) {
module.exports = function (file) {
return function (style, next) {
return next(null, style)
}
}

@@ -1,12 +0,17 @@

var sheetify = require('../sheetify')
var wrap = require('wrap-selectors')
var test = require('tape')
var fs = require('fs')
const concat = require('concat-stream')
const wrap = require('wrap-selectors')
const test = require('tape')
const fs = require('fs')
test('basic', function(t) {
var expects = fs.readFileSync(__dirname + '/fixtures/basic-expected.css')
var bundler = sheetify(__dirname + '/fixtures/basic.css')
require('./concat')
bundler.transform(function(file) {
return function(ast, next) {
const sheetify = require('..')
test('basic', function (t) {
t.plan(2)
const expects = fs.readFileSync(__dirname + '/fixtures/basic-expected.css')
const bundler = sheetify(__dirname + '/fixtures/basic.css')
bundler.transform(function (file) {
return function (ast, next) {
next(null, wrap()(ast))

@@ -16,15 +21,15 @@ }

bundler.bundle(function(err, output) {
bundler.bundle(function (err, output) {
t.ifError(err, 'bundled without error')
t.equal(String(expects).trim(), output.trim(), 'expected output')
t.end()
})
})
test('imports', function(t) {
var expects = fs.readFileSync(__dirname + '/fixtures/imports-expected.css')
var bundler = sheetify(__dirname + '/fixtures/imports.css')
test('stream', function (t) {
t.plan(1)
const expects = fs.readFileSync(__dirname + '/fixtures/basic-expected.css')
const bundler = sheetify(__dirname + '/fixtures/basic.css')
bundler.transform(function(file) {
return function(ast, next) {
bundler.transform(function (file) {
return function (ast, next) {
next(null, wrap()(ast))

@@ -34,7 +39,22 @@ }

bundler.bundle(function(err, output) {
bundler.bundle().pipe(concat(function (css) {
t.equal(expects.toString().trim(), css.toString().trim())
}))
})
test('imports', function (t) {
t.plan(2)
const expects = fs.readFileSync(__dirname + '/fixtures/imports-expected.css')
const bundler = sheetify(__dirname + '/fixtures/imports.css')
bundler.transform(function (file) {
return function (ast, next) {
next(null, wrap()(ast))
}
})
bundler.bundle(function (err, output) {
t.ifError(err, 'bundled without error')
t.equal(String(expects).trim(), output.trim(), 'expected output')
t.end()
})
})
# editorconfig.org
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
#!/usr/bin/env node
var resolve = require('style-resolve')
var sheetify = require('./sheetify')
var subarg = require('subarg')
var path = require('path')
var fs = require('fs')
var argv = subarg(
process.argv.slice(2)
)
convertAliases(argv, {
t: 'transform'
, c: 'compress'
, v: 'version'
, d: 'debug'
}, {
transform: []
})
var files = argv._
files = files.map(String)
files = files.map(function(entry) {
return /^\.\//g.test(entry)
? entry
: './' + entry
})
if (!files.length) return help()
var bundler = sheetify(files)
argv.transform.forEach(function(tr) {
bundler.transform(tr)
})
bundler.bundle({
compress: argv.compress || false
, debug: argv.debug || false
}, function(err, data) {
if (err) throw err
process.stdout.write(data)
process.stdout.write('\n')
})
function help() {
var $0 = path.basename(process.argv[1])
var usage = fs.readFileSync(
__dirname + '/usage.txt', 'utf8'
)
process.stdout.write(
usage.replace(/\$0/g, $0)
)
}
function convertAliases(argv, aliases, defaults) {
Object.keys(aliases).forEach(function(alias) {
var key = aliases[alias]
if (key in argv) argv[key] = makeArray(argv[key])
if (!(alias in argv)) return
var value = makeArray(argv[alias])
argv[key] = argv[key]
? value.concat(argv[key])
: value
delete argv[alias]
})
Object.keys(defaults).forEach(function(key) {
if (key in argv) return
argv[key] = defaults[key]
})
}
function makeArray(value) {
return Array.isArray(value)
? value
:[value]
}
var styledeps = require('style-deps')
var resolve = require('style-resolve')
var xtend = require('xtend')
module.exports = Sheetify
// for now, stylify has no "core"
// modules.
var core = {}
function Sheetify(entry) {
if (!(this instanceof Sheetify)) return new Sheetify(entry)
if (Array.isArray(entry) && entry.length > 1) throw new Error(
'Support for more than one entry css file ' +
'is not currently available.'
)
this.transforms = []
this.entry = Array.isArray(entry)
? entry[0]
: entry
return this
}
Sheetify.prototype.transform = function(transform) {
this.transforms.push(transform)
return this
}
Sheetify.prototype.bundle = function(opts, done) {
if (typeof opts === 'function') {
done = opts
opts = {}
}
return styledeps(this.entry, xtend(opts || {}, {
transforms: this.transforms
, modifiers: this.modifiers
}), done)
}
Usage:
$0 [entry file] {OPTIONS}
Options:
--transform, -t Include a sheetify transform.
--compress, -c Compress final output.
--version, -v Output version information and quit.
--debug, -d Inline CSS sourcemaps to final output.

Sorry, the diff of this file is not supported yet