postcss

Postcss - color function plugin - “Unable to parse color from string”

依然范特西╮ 提交于 2021-02-17 05:30:15
问题 Using the following postcss plugins: postcss-cssnext postcss-nested postcss-color-function I constantly hit the following error, when using the following color function. Unable to parse color from string "l(-20%)" styles.css @import 'variables.css'; // ^-- contains: --blue: #3892e0; & a { color: color(var(--blue), l(-20%)); &:hover { color: color(var(--blue), l(0%)); } } Webpack 2 snippet { loader: 'postcss-loader', options: { plugins: [ cssImport({ path: './src' }), cssnext({ browsers: [

Sass-like functions in PostCSS

落爺英雄遲暮 提交于 2021-02-07 12:33:16
问题 I'm trying out PostCss and trying to find comparable features to Sass. The one feature I'm stuck on is Sass-like functions. Here's my function is Sass: // Variables.scss $columns: 12; // Grid columns $max-width: 1200px; // Grid max width // Function.scss @function grid($cols,$to-px:false) { @if ($to-px == false) { @return ($cols / $columns) * 100% }; @return round(($max-width / $columns) * $cols); } // style.scss .class { width: grid(3); } .class2 { width: grid(3,true); } // outputs to: //

PostCSS error: [object Object] is not a PostCSS plugin

假装没事ソ 提交于 2021-02-06 08:41:31
问题 The error is coming from the postcss plugin, I think I may have written it incorrectly. I'm trying to add cssnano and autoprefixer to the postcss plugin. gulp/node_modules/gulp-postcss/node_modules/postcss/lib/processor.js:143 throw new Error(i + ' is not a PostCSS plugin'); ^ Error: [object Object] is not a PostCSS plugin at Processor.normalize (/Applications/XAMPP/xamppfiles/htdocs/sites/gulp/node_modules/gulp-postcss/node_modules/postcss/lib/processor.js:143:15) at new Processor (

React craco tailwind postcss integration

[亡魂溺海] 提交于 2021-01-27 18:43:57
问题 My project use craco to start/build, I wish to integrate tailwind postcss. I have follow this tutorial https://dev.to/ryandunn/how-to-use-tailwind-with-create-react-app-and-postcss-with-no-hassle-2i09 But as a result, I am suffering with this error: My config files looks like below: craco.config.js (this one looks like where problem lies, as I feel like the style may overriding craco style underneath, so it caused above error, but not 100% sure how to resolve this puzzl.) module.exports = {

NodeJs Script that compiles scss files fails because of postcss rule for undefined variables

梦想与她 提交于 2021-01-27 05:14:48
问题 I am using scss-bundle to import an scss file and resolve all his @import statements to later save it again as scss file. This works fine and below is an example to see how it works: scss-bundle.ts import { Bundler } from 'scss-bundle'; import { relative } from 'path'; import { writeFile } from 'fs-extra'; /** Bundles all SCSS files into a single file */ async function bundleScss(input, output) { const {found, bundledContent, imports} = await new Bundler() .Bundle(input, ['./src/styles/**/*

深入学习rollup来进行打包

落花浮王杯 提交于 2021-01-21 02:43:42
深入学习rollup来进行打包 阅读目录 一:什么是Rollup? 二:如何使用Rollup来处理并打包JS文件? 三:设置Babel来使旧浏览器也支持ES6的代码 四:添加一个debug包来记录日志 五:添加插件来替代环境变量 六:添加 UglifyJS来压缩我们js的代码 七:监听文件变化的插件 --- rollup-watch 八:开启本地服务的插件 --- rollup-plugin-serve 九:实时刷新页面 --- rollup-plugin-livereload 十. 安装同时运行watcher 和 Livereload的工具 十一. rollup+PostCSS打包样式文件并添加 LiveReload 回到顶部 一:什么是Rollup? rollup是一款用来es6模块打包代码的构建工具(支持css和js打包)。当我们使用ES6模块编写应用或者库时,它可以打包成一个单独文件提供浏览器和Node.js来使用。 它的优点有如下 : 1. 能组合我们的脚本文件。 2. 移除未使用的代码(仅仅使用ES6语法中)。 3. 在浏览器中支持使用 Node modules。 4. 压缩文件代码使文件大小尽可能最小化。 Rollup最主要的优点是 它是基于ES2015模块的,相比于webpack或Browserify所使用的CommonJS模块更加有效率

rollup 打包 react 组件库

大憨熊 提交于 2021-01-20 21:26:00
基本需求 打包react组件,满足支持 typescript、sass、声明文件、map文件、代码压缩 等基本需求。 项目详情见 github: https://github.com/zhl0791/rollup-react-library-template 需要用到的插件 @rollup/plugin-json :支持 json 文件。 @rollup/plugin-node-resolve :支持查找外部模块; @rollup/plugin-commonjs :支持 CommonJS 模块; rollup-plugin-postcss-modules :支持 css module; rollup-plugin-typescript2 :支持 typescript; rollup-plugin-dts :打包声明文件; rollup-plugin-terser :代码压缩。 ... rollup.config.js 配置文件 import json from '@rollup/plugin-json'; import resolve from '@rollup/plugin-node-resolve'; import commonjs from '@rollup/plugin-commonjs'; // import { babel } from '@rollup/plugin

Cannot find module autoprefixer in NPM scripts

久未见 提交于 2021-01-20 07:55:57
问题 Under windows 10 and npm version 6.9.0, I cannot get the following script to work: "build:css": "postcss --use autoprefixer -b 'last 2 versions' < ./static/css/main.css" I'm always getting same error in the Windows console as follows: Plugin Error: Cannot find module 'autoprefixer' I've tried changing the syntax to the following one with no results: "build:css": "postcss --use autoprefixer -b \"last 10 versions\" ./static/css/main.css -o ./static/css/main-prefixed.css" Can anyone tell me

Cannot find module autoprefixer in NPM scripts

╄→гoц情女王★ 提交于 2021-01-20 07:55:39
问题 Under windows 10 and npm version 6.9.0, I cannot get the following script to work: "build:css": "postcss --use autoprefixer -b 'last 2 versions' < ./static/css/main.css" I'm always getting same error in the Windows console as follows: Plugin Error: Cannot find module 'autoprefixer' I've tried changing the syntax to the following one with no results: "build:css": "postcss --use autoprefixer -b \"last 10 versions\" ./static/css/main.css -o ./static/css/main-prefixed.css" Can anyone tell me