Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sheetify

Package Overview
Dependencies
Maintainers
3
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 5.2.0 to 6.0.0

insert.js

2

index.js

@@ -64,3 +64,3 @@ const cssPrefix = require('postcss-prefix')

var p = postcss()
if (options.global !== true) p = p.use(cssPrefix('.' + prefix))
p = p.use(cssPrefix('.' + prefix))

@@ -67,0 +67,0 @@ try {

{
"name": "sheetify",
"version": "5.2.0",
"version": "6.0.0",
"description": "Modular CSS bundler",

@@ -25,7 +25,6 @@ "repository": "stackcss/sheetify",

"falafel": "^1.2.0",
"insert-css": "^1.0.0",
"is-stream": "^1.0.1",
"insert-css": "^2.0.0",
"map-limit": "0.0.1",
"postcss": "^5.0.10",
"postcss-prefix": "^1.0.3",
"postcss-prefix": "^2.0.0",
"resolve": "^1.1.7",

@@ -38,5 +37,2 @@ "stack-trace": "0.0.9",

},
"peerDependencies": {
"insert-css": "^1.0.0"
},
"devDependencies": {

@@ -51,3 +47,2 @@ "browserify": "^13.0.0",

"from2-string": "^1.1.0",
"insert-css": "^1.0.0",
"istanbul": "^0.4.5",

@@ -54,0 +49,0 @@ "jsdom": "^9.4.2",

@@ -21,9 +21,7 @@ # sheetify

```js
const vdom = require('virtual-dom')
const hyperx = require('hyperx')
const sf = require('sheetify')
const hx = hyperx(vdom.h)
const css = require('sheetify')
const html = require('bel')
const prefix = sf`
h1 {
const prefix = css`
:host > h1 {
text-align: center;

@@ -33,3 +31,3 @@ }

const tree = hx`
const tree = html`
<section class=${prefix}>

@@ -40,3 +38,3 @@ <h1>My beautiful, centered title</h1>

document.body.appendChild(vdom.create(tree))
document.body.appendChild(tree)
```

@@ -67,8 +65,6 @@

```js
const vdom = require('virtual-dom')
const hyperx = require('hyperx')
const sf = require('sheetify')
const hx = hyperx(vdom.h)
const css = require('sheetify')
const html = require('bel')
const prefix = sf`
const prefix = css`
:host {

@@ -83,3 +79,3 @@ background-color: blue;

const tree = hx`
const tree = html`
<section class=${prefix}>

@@ -90,3 +86,3 @@ <h1>My beautiful, centered title</h1>

document.body.appendChild(vdom.create(tree))
document.body.appendChild(tree)
```

@@ -117,10 +113,8 @@

```js
const vdom = require('virtual-dom')
const hyperx = require('hyperx')
const sf = require('sheetify')
const hx = hyperx(vdom.h)
const css = require('sheetify')
const html = require('bel')
const prefix = sf('./my-styles.css')
const prefix = css('./my-styles.css')
const tree = hx`
const tree = html`
<section class=${prefix}>

@@ -131,3 +125,3 @@ <h1>My beautiful, centered title</h1>

document.body.appendChild(vdom.create(tree))
document.body.appendChild(tree)
```

@@ -139,19 +133,8 @@

```js
const sf = require('sheetify')
const css = require('sheetify')
sf('normalize.css')
css('normalize.css')
```
Packages from npm will not be namespaced by default.
## Toggle namespaces
To toggle namespaces for external files or npm packages:
```js
const sf = require('sheetify')
sf('./my-file.css', { global: true })
```
Be aware that when you toggle the namespace, the `:host` element matches won't
work anymore because the class it targets no longer exists. Only use this
toggle to write styles that are, well, global.
## Write to separate file on disk

@@ -175,8 +158,6 @@ To write the compiled CSS to a separate file, rather than keep it in the

```js
const vdom = require('virtual-dom')
const hyperx = require('hyperx')
const sf = require('sheetify')
const hx = hyperx(vdom.h)
const css = require('sheetify')
const html = require('bel')
const prefix = sf`
const prefix = css`
h1 {

@@ -187,3 +168,3 @@ transform: translate(0, 0);

const tree = hx`
const tree = html`
<section class=${prefix}>

@@ -194,3 +175,3 @@ <h1>My beautiful, centered title</h1>

document.body.appendChild(vdom.create(tree))
document.body.appendChild(tree)
```

@@ -197,0 +178,0 @@

const sf = require('sheetify')
const prefix = sf`
hello, world {
:host .hello, :host .world {
transform: translate(0, 0);

@@ -6,0 +6,0 @@ }

const sf = require('sheetify')
const prefix = sf`.foo {
const prefix = sf`:host .foo {
color: blue;

@@ -5,0 +5,0 @@ }

const browserify = require('browserify')
const concat = require('concat-stream')
const through = require('through2')
const test = require('tape')

@@ -25,2 +26,9 @@ const path = require('path')

.transform(sheetify)
.transform(function (file) {
return through(function (buf, enc, next) {
const str = buf.toString('utf8')
this.push(str.replace(/sheetify\/insert/, 'insert-css'))
next()
})
})
.plugin('css-extract', { out: outFn })

@@ -27,0 +35,0 @@ .bundle()

const browserify = require('browserify')
const concat = require('concat-stream')
const through = require('through2')
const test = require('tape')

@@ -27,2 +28,9 @@ const path = require('path')

})
.transform(function (file) {
return through(function (buf, enc, next) {
const str = buf.toString('utf8')
this.push(str.replace(/sheetify\/insert/, 'insert-css'))
next()
})
})
.plugin('css-extract', { out: outFn })

@@ -29,0 +37,0 @@ .bundle()

const browserify = require('browserify')
const concat = require('concat-stream')
const through = require('through2')
const test = require('tape')

@@ -51,2 +52,9 @@ const path = require('path')

.transform(transform)
.transform(function (file) {
return through(function (buf, enc, next) {
const str = buf.toString('utf8')
this.push(str.replace(/sheetify\/insert/, 'insert-css'))
next()
})
})
.plugin('css-extract', { out: outFn })

@@ -65,3 +73,3 @@ .bundle(parseBundle)

function log (msg) {
t.equal(msg, '_0081131d', 'echoes prefix')
t.equal(msg, '_f918f624', 'echoes prefix')
}

@@ -86,2 +94,9 @@ }

.transform(transform)
.transform(function (file) {
return through(function (buf, enc, next) {
const str = buf.toString('utf8')
this.push(str.replace(/sheetify\/insert/, 'insert-css'))
next()
})
})
.plugin('css-extract', { out: outFn })

@@ -100,29 +115,6 @@ .bundle(parseBundle)

function log (msg) {
t.equal(msg, '_0081131d', 'echoes prefix')
t.equal(msg, '_f918f624', 'echoes prefix')
}
}
})
t.test('should disable prefixing when global:true', function (t) {
t.plan(1)
const expath = path.join(__dirname, 'fixtures/prefix-global-expected.css')
const expected = fs.readFileSync(expath, 'utf8').trim()
const ws = concat(function (buf) {
const res = String(buf).trim()
t.equal(res, expected, 'css is equal')
})
const bOpts = { browserField: false }
const bpath = path.join(__dirname, 'fixtures/prefix-global-source.js')
browserify(bpath, bOpts)
.transform(transform)
.plugin('css-extract', { out: outFn })
.bundle()
function outFn () {
return ws
}
})
})
const cssResolve = require('style-resolve').sync
const staticEval = require('static-eval')
const mapLimit = require('map-limit')
const isStream = require('is-stream')
const through = require('through2')
const falafel = require('falafel')
const assert = require('assert')
const xtend = require('xtend')

@@ -27,11 +25,4 @@ const path = require('path')

if (opts.o) opts.out = opts.o
opts.use = [].concat(opts.use || []).concat(opts.u || [])
// argv parsing
if (opts.out) {
if (typeof opts.out === 'string') opts.out = path.resolve(opts.out)
else assert.ok(isStream(opts.out), 'opts.out must be a path or a stream')
}
const bufs = []

@@ -120,4 +111,2 @@ const transformStream = through(write, end)

if (node.callee.name !== mname) return
const isLocalFile = /^\.{0,2}\//.test(node.arguments[0].value)
const localOptions = { global: !isLocalFile }
try {

@@ -132,5 +121,5 @@ var resolvePath = cssResolve(node.arguments[0].value, {

const iOpts = node.arguments[1]
? xtend(opts, localOptions, staticEval(node.arguments[1]))
: xtend(opts, localOptions)
const iOpts = (node.arguments[1])
? xtend(opts, staticEval(node.arguments[1]))
: opts

@@ -162,3 +151,3 @@ const val = {

const str = [
"((require('insert-css')(" + JSON.stringify(css) + ')',
"((require('sheetify/insert')(" + JSON.stringify(css) + ')',
' || true) && ' + JSON.stringify(prefix) + ')'

@@ -165,0 +154,0 @@ ].join('')

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc