Skip to content

Commit

Permalink
remove webpack option
Browse files Browse the repository at this point in the history
  • Loading branch information
jescalan committed Feb 9, 2017
1 parent 8adbf5e commit df8a8d8
Show file tree
Hide file tree
Showing 4 changed files with 464 additions and 557 deletions.
15 changes: 4 additions & 11 deletions README.md
Expand Up @@ -44,26 +44,19 @@ By default, the css standard plugin pack includes:
Any of these plugins can be customized by passing the [options](#options) described below. You can also add additional postCSS plugins (like the popular [`lost`](https://github.com/peterramsing/lost) grid, for example) on top of this package:

```js
// app.js
const cssStandards = require('spike-css-standards')
const lost = require('lost')

// ...
postcss: (ctx) => {
const css = cssStandards({ webpack: ctx })
css.plugins.push(lost())
return css
},
// ...
const css = cssStandards()
css.plugins.push(lost())
```

### Options

| Name | Description | Default |
| ---- | ----------- | ------- |
| **root** | Root used to resolve `path`(s) from | If `webpack` option is provided, `options.context` |
| **path** | A path to a folder or an array of paths, telling postcss-import where to look for sss or css files to `@import`. | If `webpack` option is provided, `loaderContext.resourcePath` |
| **webpack** | Shortcut for webpack users to set the `root` and `path` options more easily. Pass webpack loader context. | |
| **root** | Root used to resolve `path`(s) from | |
| **path** | A path to a folder or an array of paths, telling postcss-import where to look for sss or css files to `@import`. | |
| **browsers** | Browser support provided to [autoprefixer](http://cssnext.io/usage/#browsers) | `> 1%, last 2 versions, Firefox ESR` |
| **features** | Enable or disable [cssnext features](http://cssnext.io/usage/#features) | |
| **warnForDuplicates** | Enable or disable [cssnext duplicate warnings](http://cssnext.io/usage/#warnforduplicates) | `true` |
Expand Down
6 changes: 0 additions & 6 deletions lib/index.js
Expand Up @@ -9,12 +9,6 @@ module.exports = (options = {}) => {
if (options.parser === false) parser = undefined
options.path = options.path ? Array.prototype.concat(options.path) : []

// define root/path defaults if the webpack object is provided
if (options.webpack) {
options.root = options.webpack.options.context
options.path.push(options.webpack.resourcePath)
}

// standard options merge
const importOpt = selectiveMerge(options, ['root', 'path'])
const cssnextOpt = selectiveMerge(options, ['browsers', 'features', 'warnForDuplicates'])
Expand Down
8 changes: 2 additions & 6 deletions test/index.js
Expand Up @@ -8,7 +8,6 @@ test('basic', (t) => {
t.truthy(opts.root === 'test')
t.truthy(opts.path[0] === 'test/test1')
t.truthy(opts.path[1] === 'test/test2')
t.truthy(opts.path[2] === 'test') // webpack.resourcePath
})

cssStandardsRewired.__set__('cssnext', (opts) => {
Expand All @@ -23,15 +22,12 @@ test('basic', (t) => {

const out1 = cssStandardsRewired({
parser: false,
webpack: {
resourcePath: 'test',
options: { context: 'test' }
},
path: ['test/test1', 'test/test2'],
features: 'test',
browsers: 'test',
warnForDuplicates: 'test',
rucksack: 'test'
rucksack: 'test',
root: 'test'
})

t.truthy(out1.plugins.length === 3)
Expand Down

0 comments on commit df8a8d8

Please sign in to comment.