Answer the question
In order to leave comments, you need to log in
How to pass an array of variables to postcss-simple-vars?
Let's say we have this code:
var colors = require('./src/config/colors');
var nav = require('./src/config/navbar');
var processors = [
require('postcss-simple-vars')({ variables: [colors, nav] })
]
// colors.js
module.exports = {
black: '#111',
white: '#fff',
gray: '#aaa',
silver: '#ddd',
primary: '#0074d9',
success: '#2ecc40',
warning: '#ff851b',
danger: '#ff4136'
}
//navbar.js
module.exports = {
navbar_height: '50px',
navbar_bg: '$white'
}
body {
background-color: $white;
color: $black;
}
.navbar {
height: $navbar_height;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question