andyjansson / postcss-sassy-mixins Goto Github PK
View Code? Open in Web Editor NEWPostCSS plugin for sass-like mixins
License: MIT License
PostCSS plugin for sass-like mixins
License: MIT License
When compiling with postcss-sassy-mixins added as a processor:
Container#eachAtRule is deprecated. Use Container#walkAtRules instead.
Node#removeSelf is deprecated. Use Node#remove.
In Sass, @content
is optional (if you just want what's included). E.g.
@mixin hover($color: null) {
&:hover {
text-decoration: underline
color: $color;
@content;
}
}
label {
@include hover(blue); // no `@content` (i.e. {}) defined`
}
This same setup currently errors. At least @include hover(blue){}
must be written. It would be nice to optionally leave any content off and simply default to having been passed an empty object.
Could you update dependencies (at least PostCSS)?
@mixin foo {
color: red;
}
@mixin bar {
@include foo;
background-color: blue;
}
.baz {
@include bar;
}
/* Result */
.baz {
@include foo;
background-color: blue;
}
/* Expected Result */
.baz {
color: red;
background-color: blue;
}
Request: Currently it seems only sassy variables (or real values) are allowed as arguments. Doing this:
@mixin paint($color){
color: $color;
}
.icon {@include paint( var(--color-primary) )}
Will return literally color: var(--color-primary)
rather than extrapolate.
The current workaround is to simply define $color-primary: var(--color-secondary);
right above and then use this sassy variable within the function.
You should write clear what is the difference between this two plugins.
As per http://sass-lang.com/guide, seems to me the plugin is using Scss syntax, not Sass', which looks like this:
=transform($property)
-webkit-transform: $property
-ms-transform: $property
transform: $property
.box
+transform(rotate(30deg))
Hi, I'm migrating from sass to postcss.
I get an error trying to compile the plugin saying: Unknown word @mixin
any ideas?
this is the mixin I'm defining
@mixin rem($px) {
($px/16) * 1rem;
}
and this is where i use it
.header {
font-size: @include rem(75)
}
these are the parts in my webpack config relevant to css:
var webpack = require('webpack');
var precss = require('precss');
var autoprefixer = require('autoprefixer');
var mixins = require('postcss-sassy-mixins');
module.exports = {
module: {
loaders: [
{
test: /\.css$/,
loader: "style-loader!css-loader?modules&importLoaders=1!postcss-loader"
}
]
},
postcss: function () {
return [precss, mixins, autoprefixer];
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.DefinePlugin({
'process.env': {
CLIENT: JSON.stringify(true)
}
})
],
};
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.