Skip to content
This repository was archived by the owner on Dec 21, 2021. It is now read-only.

Commit 058391d

Browse files
3.0.0
1 parent 4b6b237 commit 058391d

15 files changed

+268
-250
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
dist
12
node_modules
23
index.*.*
34
package-lock.json

.rollup.js

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,9 @@
1-
import babel from 'rollup-plugin-babel';
1+
import pkg from './package.json'
22

33
export default {
4-
input: 'index.js',
5-
output: [
6-
{ file: 'index.cjs.js', format: 'cjs', sourcemap: true },
7-
{ file: 'index.es.mjs', format: 'es', sourcemap: true }
8-
],
9-
plugins: [
10-
babel({
11-
presets: [
12-
['@babel/env', { modules: false, targets: { node: 6 } }]
13-
]
14-
})
15-
]
16-
};
4+
...pkg.rollup,
5+
plugins: pkg.rollup.plugins.map(plugin => require(plugin)()),
6+
onwarn(warning, warn) {
7+
if (warning.code !== 'UNRESOLVED_IMPORT') warn(warning)
8+
}
9+
}

.tape.js

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
module.exports = {
2-
'postcss-lab-function': {
3-
'basic': {
4-
message: 'supports basic usage'
5-
},
6-
'basic:preserve-true': {
7-
message: 'supports { preserve: true } usage',
8-
options: {
9-
preserve: true
10-
}
2+
'basic': {
3+
message: 'supports basic usage'
4+
},
5+
'basic:preserve-true': {
6+
message: 'supports { preserve: true } usage',
7+
options: {
8+
preserve: true
119
}
1210
}
13-
};
11+
}

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
language: node_js
44

55
node_js:
6-
- 6
6+
- 10
77

88
install:
99
- npm install --ignore-scripts
10+
- npm run build

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Changes to PostCSS Lab Function
22

3+
### 3.0.0 (April 12, 2020)
4+
5+
- Updated: `postcss-values-parser` to 3.1.1 (major).
6+
- Updated: Node support to 10.0.0 (major).
7+
- Updated: Feature to use new percentage syntax.
8+
- Removed: Support for the removed `gray()` function.
9+
310
### 2.0.1 (September 18, 2018)
411

512
- Updated: PostCSS Values Parser 2.0.0

README.md

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,25 @@
11
# PostCSS Lab Function [<img src="https://postcss.github.io/postcss/logo.svg" alt="PostCSS Logo" width="90" height="90" align="right">][postcss]
22

3-
[![NPM Version][npm-img]][npm-url]
4-
[![CSS Standard Status][css-img]][css-url]
5-
[![Build Status][cli-img]][cli-url]
6-
[![Support Chat][git-img]][git-url]
3+
[<img alt="npm version" src="https://img.shields.io/npm/v/postcss-lab-function.svg" height="20">][npm-url]
4+
[<img alt="CSS Standard Status" src="https://cssdb.org/badge/lab-function.svg" height="20">][css-url]
5+
[<img alt="build status" src="https://img.shields.io/travis/jonathantneal/postcss-lab-function/master.svg" height="20">][cli-url]
6+
[<img alt="support chat" src="https://img.shields.io/badge/support-chat-blue.svg" height="20">][git-url]
77

8-
[PostCSS Lab Function] lets you use `lab`, `lch`, and `gray` color functions in
9-
CSS, following the [CSS Color] specification.
8+
9+
[PostCSS Lab Function] lets you use `lab` and `lch` color functions in
10+
CSS, following the [CSS Color] specification.
1011

1112
```pcss
1213
:root {
1314
--firebrick: lab(40% 56.6 39);
1415
--firebrick-a50: lch(40% 68.8 34.5 / 50%);
15-
--gray-40: gray(40);
16-
--gray-40a50: gray(40 / .5);
1716
}
1817
1918
/* becomes */
2019
2120
:root {
2221
--firebrick: rgb(178, 34, 34);
2322
--firebrick-a50: rgba(178, 34, 34, .5);
24-
--gray-40: rgb(94,94,94);
25-
--gray-40a50: rgba(94,94,94, .5);
2623
}
2724
```
2825

@@ -86,13 +83,9 @@ postcssLabFunction({ preserve: true })
8683
}
8784
```
8885

89-
[cli-img]: https://img.shields.io/travis/jonathantneal/postcss-lab-function.svg
9086
[cli-url]: https://travis-ci.org/jonathantneal/postcss-lab-function
91-
[css-img]: https://cssdb.org/badge/lab-function.svg
9287
[css-url]: https://cssdb.org/#lab-function
93-
[git-img]: https://img.shields.io/badge/support-chat-blue.svg
9488
[git-url]: https://gitter.im/postcss/postcss
95-
[npm-img]: https://img.shields.io/npm/v/postcss-lab-function.svg
9689
[npm-url]: https://www.npmjs.com/package/postcss-lab-function
9790

9891
[CSS Color]: https://drafts.csswg.org/css-color/#specifying-lab-lch

index.js

Lines changed: 0 additions & 154 deletions
This file was deleted.

package.json

Lines changed: 47 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,69 @@
11
{
22
"name": "postcss-lab-function",
3-
"version": "2.0.1",
3+
"version": "3.0.0",
44
"description": "Use lab() and lch() color functions in CSS",
55
"author": "Jonathan Neal <jonathantneal@hotmail.com>",
66
"license": "CC0-1.0",
77
"repository": "jonathantneal/postcss-lab-function",
88
"homepage": "https://github.com/jonathantneal/postcss-lab-function#readme",
99
"bugs": "https://github.com/jonathantneal/postcss-lab-function/issues",
10-
"main": "index.cjs.js",
11-
"module": "index.es.mjs",
10+
"main": "dist/index.cjs.js",
11+
"module": "dist/index.esm.mjs",
1212
"files": [
13-
"index.cjs.js",
14-
"index.cjs.js.map",
15-
"index.es.mjs",
16-
"index.es.mjs.map"
13+
"dist"
1714
],
1815
"scripts": {
19-
"prepublishOnly": "npm test",
20-
"pretest": "rollup -c .rollup.js --silent",
21-
"test": "echo 'Running tests...'; npm run test:js && npm run test:tape",
22-
"test:ec": "echint --ignore index.*.js test",
23-
"test:js": "eslint *.js --cache --ignore-path .gitignore --quiet",
24-
"test:tape": "postcss-tape"
16+
"build": "npx rollup -c .rollup.js",
17+
"build:watch": "npx rollup -c .rollup.js --watch",
18+
"lint": "npx eslint --cache src",
19+
"lint:fix": "npx eslint --cache --fix",
20+
"test": "npm run lint && npm run tape",
21+
"tape": "npx postcss-tape"
2522
},
2623
"engines": {
27-
"node": ">=6.0.0"
24+
"node": ">=10.0.0"
2825
},
2926
"dependencies": {
30-
"@csstools/convert-colors": "^1.4.0",
31-
"postcss": "^7.0.2",
32-
"postcss-values-parser": "^2.0.0"
27+
"@csstools/convert-colors": "^2.0.0",
28+
"postcss": "^7.0.27",
29+
"postcss-values-parser": "^3.1.1"
3330
},
3431
"devDependencies": {
35-
"@babel/core": "^7.1.0",
36-
"@babel/preset-env": "^7.1.0",
37-
"babel-eslint": "^9.0.0",
38-
"eslint": "^5.6.0",
39-
"eslint-config-dev": "^2.0.0",
40-
"postcss-tape": "^2.2.0",
41-
"pre-commit": "^1.2.2",
42-
"rollup": "^0.66.0",
43-
"rollup-plugin-babel": "^4.0.3"
32+
"@babel/core": "^7.9.0",
33+
"@babel/preset-env": "^7.9.5",
34+
"babel-eslint": "^10.1.0",
35+
"eslint": "^6.8.0",
36+
"postcss-tape": "^5.0.2",
37+
"rollup": "^2.6.0",
38+
"rollup-plugin-babel": "^4.4.0"
4439
},
4540
"eslintConfig": {
46-
"extends": "dev",
47-
"parser": "babel-eslint"
41+
"parser": "babel-eslint",
42+
"ignorePatterns": [
43+
"dist",
44+
"node_modules"
45+
]
46+
},
47+
"babel": {
48+
"presets": [
49+
"@babel/env"
50+
]
51+
},
52+
"rollup": {
53+
"input": "src/index.js",
54+
"plugins": [
55+
"rollup-plugin-babel"
56+
],
57+
"output": [
58+
{
59+
"file": "dist/index.cjs.js",
60+
"format": "cjs"
61+
},
62+
{
63+
"file": "dist/index.esm.js",
64+
"format": "esm"
65+
}
66+
]
4867
},
4968
"keywords": [
5069
"postcss",

src/index.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import postcss from 'postcss'
2+
import onDeclaration from './onDeclaration'
3+
import options from './options'
4+
5+
/** Transform lab() and lch() functions in CSS. */
6+
const plugin = postcss.plugin('postcss-lab-function', /** @type {PostCSSPluginInitializer} */ opts => {
7+
options.preserve = 'preserve' in Object(opts) ? Boolean(opts.preserve) : false
8+
9+
return root => {
10+
root.walkDecls(onDeclaration)
11+
}
12+
})
13+
14+
export default plugin
15+
16+
/** @typedef {import('postcss').Root} CSSRoot */
17+
/** @typedef {(root: CSSRoot) => void} PostCSSTransformCallback */
18+
/** @typedef {(opts: options) => PostCSSTransformCallback} PostCSSPluginInitializer */

0 commit comments

Comments
 (0)