Skip to content

postcss-sign-functions #1508

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/css-issue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ body:
- PostCSS Replace Overflow Wrap
- PostCSS Scope Pseudo Class
- PostCSS Selector Not
- PostCSS Sign Functions
- PostCSS Slow Plugins
- PostCSS Stepped Value Functions
- PostCSS System Ui Font Family
Expand Down
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/plugin-issue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ body:
- PostCSS Replace Overflow Wrap
- PostCSS Scope Pseudo Class
- PostCSS Selector Not
- PostCSS Sign Functions
- PostCSS Slow Plugins
- PostCSS Stepped Value Functions
- PostCSS System Ui Font Family
Expand Down
6 changes: 6 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,12 @@
- plugins/postcss-selector-not/**
- experimental/postcss-selector-not/**

"plugins/postcss-sign-functions":
- changed-files:
- any-glob-to-any-file:
- plugins/postcss-sign-functions/**
- experimental/postcss-sign-functions/**

"plugins/postcss-slow-plugins":
- changed-files:
- any-glob-to-any-file:
Expand Down
32 changes: 32 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions plugins/postcss-sign-functions/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules
package-lock.json
yarn.lock
*.result.css
*.result.css.map
*.result.html
1 change: 1 addition & 0 deletions plugins/postcss-sign-functions/.nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v20.2.0
5 changes: 5 additions & 0 deletions plugins/postcss-sign-functions/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Changes to PostCSS Sign Functions

### Unreleased (major)

- Initial version
235 changes: 235 additions & 0 deletions plugins/postcss-sign-functions/INSTALL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,235 @@
# Installing PostCSS Sign Functions

[PostCSS Sign Functions] runs in all Node environments, with special instructions for:

- [Node](#node)
- [PostCSS CLI](#postcss-cli)
- [PostCSS Load Config](#postcss-load-config)
- [Webpack](#webpack)
- [Next.js](#nextjs)
- [Gulp](#gulp)
- [Grunt](#grunt)



## Node

Add [PostCSS Sign Functions] to your project:

```bash
npm install postcss @csstools/postcss-sign-functions --save-dev
```

Use it as a [PostCSS] plugin:

```js
// commonjs
const postcss = require('postcss');
const postcssSignFunctions = require('@csstools/postcss-sign-functions');

postcss([
postcssSignFunctions(/* pluginOptions */)
]).process(YOUR_CSS /*, processOptions */);
```

```js
// esm
import postcss from 'postcss';
import postcssSignFunctions from '@csstools/postcss-sign-functions';

postcss([
postcssSignFunctions(/* pluginOptions */)
]).process(YOUR_CSS /*, processOptions */);
```

## PostCSS CLI

Add [PostCSS CLI] to your project:

```bash
npm install postcss-cli @csstools/postcss-sign-functions --save-dev
```

Use [PostCSS Sign Functions] in your `postcss.config.js` configuration file:

```js
const postcssSignFunctions = require('@csstools/postcss-sign-functions');

module.exports = {
plugins: [
postcssSignFunctions(/* pluginOptions */)
]
}
```

## PostCSS Load Config

If your framework/CLI supports [`postcss-load-config`](https://github.com/postcss/postcss-load-config).

```bash
npm install @csstools/postcss-sign-functions --save-dev
```

`package.json`:

```json
{
"postcss": {
"plugins": {
"@csstools/postcss-sign-functions": {}
}
}
}
```

`.postcssrc.json`:

```json
{
"plugins": {
"@csstools/postcss-sign-functions": {}
}
}
```

_See the [README of `postcss-load-config`](https://github.com/postcss/postcss-load-config#usage) for more usage options._

## Webpack

_Webpack version 5_

Add [PostCSS Loader] to your project:

```bash
npm install postcss-loader @csstools/postcss-sign-functions --save-dev
```

Use [PostCSS Sign Functions] in your Webpack configuration:

```js
module.exports = {
module: {
rules: [
{
test: /\.css$/i,
use: [
"style-loader",
{
loader: "css-loader",
options: { importLoaders: 1 },
},
{
loader: "postcss-loader",
options: {
postcssOptions: {
plugins: [
// Other plugins,
[
"@csstools/postcss-sign-functions",
{
// Options
},
],
],
},
},
},
],
},
],
},
};
```

## Next.js

Read the instructions on how to [customize the PostCSS configuration in Next.js](https://nextjs.org/docs/advanced-features/customizing-postcss-config)

```bash
npm install @csstools/postcss-sign-functions --save-dev
```

Use [PostCSS Sign Functions] in your `postcss.config.json` file:

```json
{
"plugins": [
"@csstools/postcss-sign-functions"
]
}
```

```json5
{
"plugins": [
[
"@csstools/postcss-sign-functions",
{
// Optionally add plugin options
}
]
]
}
```

## Gulp

Add [Gulp PostCSS] to your project:

```bash
npm install gulp-postcss @csstools/postcss-sign-functions --save-dev
```

Use [PostCSS Sign Functions] in your Gulpfile:

```js
const postcss = require('gulp-postcss');
const postcssSignFunctions = require('@csstools/postcss-sign-functions');

gulp.task('css', function () {
var plugins = [
postcssSignFunctions(/* pluginOptions */)
];

return gulp.src('./src/*.css')
.pipe(postcss(plugins))
.pipe(gulp.dest('.'));
});
```

## Grunt

Add [Grunt PostCSS] to your project:

```bash
npm install grunt-postcss @csstools/postcss-sign-functions --save-dev
```

Use [PostCSS Sign Functions] in your Gruntfile:

```js
const postcssSignFunctions = require('@csstools/postcss-sign-functions');

grunt.loadNpmTasks('grunt-postcss');

grunt.initConfig({
postcss: {
options: {
processors: [
postcssSignFunctions(/* pluginOptions */)
]
},
dist: {
src: '*.css'
}
}
});
```

[Gulp PostCSS]: https://github.com/postcss/gulp-postcss
[Grunt PostCSS]: https://github.com/nDmitry/grunt-postcss
[PostCSS]: https://github.com/postcss/postcss
[PostCSS CLI]: https://github.com/postcss/postcss-cli
[PostCSS Loader]: https://github.com/postcss/postcss-loader
[PostCSS Sign Functions]: https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-sign-functions
[Next.js]: https://nextjs.org
18 changes: 18 additions & 0 deletions plugins/postcss-sign-functions/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
MIT No Attribution (MIT-0)

Copyright © CSSTools Contributors

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the “Software”), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading