Skip to content

Latest commit

 

History

History
235 lines (182 loc) · 4.85 KB

File metadata and controls

235 lines (182 loc) · 4.85 KB

Installing PostCSS Gradients Interpolation Method

PostCSS Gradients Interpolation Method runs in all Node environments, with special instructions for:

Node

Add PostCSS Gradients Interpolation Method to your project:

npm install postcss @csstools/postcss-gradients-interpolation-method --save-dev

Use it as a PostCSS plugin:

// commonjs
const postcss = require('postcss');
const postcssGradientsInterpolationMethod = require('@csstools/postcss-gradients-interpolation-method');

postcss([
	postcssGradientsInterpolationMethod(/* pluginOptions */)
]).process(YOUR_CSS /*, processOptions */);
// esm
import postcss from 'postcss';
import postcssGradientsInterpolationMethod from '@csstools/postcss-gradients-interpolation-method';

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

PostCSS CLI

Add PostCSS CLI to your project:

npm install postcss-cli @csstools/postcss-gradients-interpolation-method --save-dev

Use PostCSS Gradients Interpolation Method in your postcss.config.js configuration file:

const postcssGradientsInterpolationMethod = require('@csstools/postcss-gradients-interpolation-method');

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

PostCSS Load Config

If your framework/CLI supports postcss-load-config.

npm install @csstools/postcss-gradients-interpolation-method --save-dev

package.json:

{
	"postcss": {
		"plugins": {
			"@csstools/postcss-gradients-interpolation-method": {}
		}
	}
}

.postcssrc.json:

{
	"plugins": {
		"@csstools/postcss-gradients-interpolation-method": {}
	}
}

See the README of postcss-load-config for more usage options.

Webpack

Webpack version 5

Add PostCSS Loader to your project:

npm install postcss-loader @csstools/postcss-gradients-interpolation-method --save-dev

Use PostCSS Gradients Interpolation Method in your Webpack configuration:

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-gradients-interpolation-method",
										{
											// Options
										},
									],
								],
							},
						},
					},
				],
			},
		],
	},
};

Next.js

Read the instructions on how to customize the PostCSS configuration in Next.js

npm install @csstools/postcss-gradients-interpolation-method --save-dev

Use PostCSS Gradients Interpolation Method in your postcss.config.json file:

{
	"plugins": [
		"@csstools/postcss-gradients-interpolation-method"
	]
}
{
	"plugins": [
		[
			"@csstools/postcss-gradients-interpolation-method",
			{
				// Optionally add plugin options
			}
		]
	]
}

Gulp

Add Gulp PostCSS to your project:

npm install gulp-postcss @csstools/postcss-gradients-interpolation-method --save-dev

Use PostCSS Gradients Interpolation Method in your Gulpfile:

const postcss = require('gulp-postcss');
const postcssGradientsInterpolationMethod = require('@csstools/postcss-gradients-interpolation-method');

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

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

Grunt

Add Grunt PostCSS to your project:

npm install grunt-postcss @csstools/postcss-gradients-interpolation-method --save-dev

Use PostCSS Gradients Interpolation Method in your Gruntfile:

const postcssGradientsInterpolationMethod = require('@csstools/postcss-gradients-interpolation-method');

grunt.loadNpmTasks('grunt-postcss');

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