diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..43c97e7 --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +package-lock=false diff --git a/.travis.yml b/.travis.yml index d276213..ddbc366 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,6 @@ language: node_js node_js: -- "4" -- "6" - "8" - "10" +- "12" - "node" diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..bf104e4 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,7 @@ +# postcss-prefix change log +All notable changes to this project will be documented in this file. +This project adheres to [Semantic Versioning](http://semver.org/). + +## 3.0.0 +* Update to the postcss 8 plugin API. +* Require Node.js 8+. diff --git a/README.md b/README.md index f220070..eda7f89 100644 --- a/README.md +++ b/README.md @@ -11,8 +11,7 @@ const css = ` .hello { color: black } ` -const newCss = postcss() - .use(prefix('#hello-world')) +const newCss = postcss([ prefix('#hello-world') ]) .process(css) .toString() diff --git a/index.js b/index.js index d855ad5..4d07ff9 100644 --- a/index.js +++ b/index.js @@ -3,17 +3,19 @@ const postcss = require('postcss') const Selector = require('postcss-selector-parser') -module.exports = postcss.plugin('postcss-prefix', postcssPrefix) +module.exports = postcssPrefix +postcssPrefix.postcss = true function postcssPrefix (prefix, options) { options = options || {} - return function walk (root) { - root.walkRules(function (rule) { + return { + postcssPlugin: 'postcss-prefix', + Rule: function (rule) { const selector = Selector(transformSelectors) .processSync(rule.selector) rule.selector = selector - }) + } } function transformSelectors (selectors) { diff --git a/package.json b/package.json index 27e0097..73ff10b 100644 --- a/package.json +++ b/package.json @@ -1,15 +1,20 @@ { "name": "postcss-prefix", - "version": "2.2.0", - "license": "MIT", - "repository": "stackcss/postcss-prefix", + "description": "Replace `:host` elements with a prefix of your choosing", + "version": "3.0.0", + "author": "Hugh Kennedy ", + "bugs": "https://github.com/stackcss/postcss-prefix/issues", "dependencies": { - "postcss": "^5.0.8", - "postcss-selector-parser": "^4.0.0" + "postcss-selector-parser": "^6.0.2" }, "devDependencies": { - "tape": "^4.2.1" + "postcss": "^8.0.5", + "tape": "^5.0.1" }, + "homepage": "https://github.com/stackcss/postcss-prefix", + "license": "MIT", + "main": "index.js", + "repository": "stackcss/postcss-prefix", "scripts": { "test": "tape test/index.js" }