@samatech/postcss-basics
Advanced tools
Comparing version
18
index.js
@@ -0,12 +1,18 @@ | ||
import autoprefixer from 'autoprefixer' | ||
import postcssMixins from 'postcss-mixins' | ||
import postcssSimpleVars from 'postcss-simple-vars' | ||
import postcssNested from 'postcss-nested' | ||
import postcssColors from '@samatech/postcss-colors' | ||
const plugins = [ | ||
require('autoprefixer'), | ||
require('postcss-mixins'), | ||
require('postcss-simple-vars'), | ||
require('postcss-nested'), | ||
require('@samatech/postcss-colors')() | ||
autoprefixer, | ||
postcssMixins, | ||
postcssSimpleVars, | ||
postcssNested, | ||
postcssColors(), | ||
] | ||
module.exports = (opts = {}) => { | ||
export default (opts = {}) => { | ||
// TODO -- pass along plugin options | ||
return plugins | ||
} |
{ | ||
"name": "@samatech/postcss-basics", | ||
"version": "0.6.0", | ||
"version": "0.7.1", | ||
"description": "Simple opinionated PostCSS plugin pack.", | ||
@@ -11,2 +11,3 @@ "keywords": [ | ||
], | ||
"type": "module", | ||
"author": "SamaTech <samatechtw@gmail.com>", | ||
@@ -21,3 +22,3 @@ "license": "MIT", | ||
"format": "eslint --fix --ext .js index.js", | ||
"test": "jest" | ||
"test": "vitest run" | ||
}, | ||
@@ -28,27 +29,22 @@ "peerDependencies": { | ||
"dependencies": { | ||
"@samatech/postcss-colors": "^0.4.0", | ||
"autoprefixer": "^10.4.13", | ||
"@samatech/postcss-colors": "^0.5.1", | ||
"autoprefixer": "^10.4.16", | ||
"postcss-mixins": "^9.0.4", | ||
"postcss-nested": "^6.0.0", | ||
"postcss-nested": "^6.0.1", | ||
"postcss-simple-vars": "^7.0.1" | ||
}, | ||
"devDependencies": { | ||
"eslint": "^8.32.0", | ||
"eslint-config-standard": "^17.0.0", | ||
"eslint-plugin-import": "^2.27.4", | ||
"eslint-plugin-jest": "^27.2.1", | ||
"eslint-plugin-n": "^15.6.1", | ||
"eslint": "^8.54.0", | ||
"eslint-config-standard": "^17.1.0", | ||
"eslint-plugin-import": "^2.29.0", | ||
"eslint-plugin-n": "^16.3.1", | ||
"eslint-plugin-node": "^11.1.0", | ||
"eslint-plugin-prettier": "^4.2.1", | ||
"eslint-plugin-prettier": "^5.0.1", | ||
"eslint-plugin-promise": "^6.1.1", | ||
"jest": "^29.3.1", | ||
"postcss": "^8.4.21", | ||
"prettier": "^2.8.3" | ||
"postcss": "^8.4.31", | ||
"prettier": "^3.1.0", | ||
"vitest": "^0.34.6" | ||
}, | ||
"eslintConfig": { | ||
"env": { | ||
"jest/globals": true | ||
}, | ||
"plugins": [ | ||
"jest", | ||
"prettier" | ||
@@ -58,12 +54,7 @@ ], | ||
"eslint-config-standard" | ||
] | ||
}, | ||
"jest": { | ||
"testEnvironment": "node", | ||
"coverageThreshold": { | ||
"global": { | ||
"statements": 100 | ||
} | ||
], | ||
"rules": { | ||
"comma-dangle": 0 | ||
} | ||
} | ||
} | ||
} |
@@ -28,8 +28,9 @@ # PostCSS Basics | ||
**Step 3:** Add the plugin to plugins list (note the spread operator and the extra `()` after the `require` statement): | ||
**Step 3:** Add the plugin to plugins list (note the spread operator and the extra `()` after the `import` statement): | ||
```javascript | ||
module.exports = { | ||
import postcssBasics from '@samatech/postcss-basics' | ||
export default { | ||
plugins: [ | ||
...require('@samatech/postcss-basics')(), | ||
...postcssBasics(), | ||
], | ||
@@ -41,4 +42,5 @@ }; | ||
```javascript | ||
module.exports = { | ||
plugins: require('@samatech/postcss-basics')(), | ||
import postcssBasics from '@samatech/postcss-basics' | ||
export default { | ||
plugins: postcssBasics(), | ||
}; | ||
@@ -61,3 +63,4 @@ ``` | ||
```js | ||
require('@samatech/postcss-basics')() | ||
import postcssBasics from '@samatech/postcss-basics' | ||
postcssBasics() | ||
``` |
@@ -1,6 +0,7 @@ | ||
const postcss = require('postcss') | ||
import postcss from 'postcss' | ||
import { expect } from 'vitest' | ||
const plugin = require('../') | ||
import plugin from '../' | ||
function runError (input, error) { | ||
export function runError(input, error) { | ||
const result = postcss([...plugin()]).process(input, { from: '/test.css' }) | ||
@@ -14,3 +15,3 @@ const warnings = result.warnings() | ||
function run (input, output, opts) { | ||
export function run(input, output, opts) { | ||
const result = postcss([...plugin(opts)]).process(input, { from: '/test.css' }) | ||
@@ -21,6 +22,1 @@ expect(result.css).toEqual(output) | ||
} | ||
module.exports = { | ||
runError, | ||
run, | ||
} |
Sorry, the diff of this file is not supported yet
10
-9.09%8
14.29%37
19.35%64
4.92%Yes
NaN5394
-95.91%+ Added
+ Added
- Removed
- Removed
Updated
Updated