Babel plugin which turns PreJSS constructions into JSS objects.
In
const button = ({selector}) => preJSS`
button {
color: ${props => props.disabled ? 'grey' : 'red'};
width: 200px;
height: 70px;
&:hover {
text-decoration: underline;
}
}
`
Out
var button = function button(_ref) {
var selector = _ref.selector;
return {
'button': {
'color': function color(props) {
return props.disabled ? 'grey' : 'red';
},
'width': '200px',
'height': '70px',
'&:hover': {
'textDecoration': 'underline'
}
}
};
};
See more details here: https://github.com/axept/prejss
npm install babel-plugin-transform-prejss --save-dev
-
removeImport: <Boolean|String>
- by default isprejss
. You can configure it tofalse
if you wouldn't like to remove imports for "prejss" automatically. But think twice! By disabling this option you may include server code and a lot of unnecessary dependencies into your bundle. -
silent: <Boolean>
- by default isfalse
. This option is configuring if the plugin should or not to log about each removed prejss import. -
namespace: <String>
- by default ispreJSS
.babelrc
{
"plugins": ["transform-prejss"]
}
babel --plugins transform-prejss script.js
require("babel-core").transform("code", {
plugins: ["transform-prejss"]
});