Component based styles for the web. Parata enforces you to build re-usable components for the web and generates a component wise styleguide.
Parata is packaged as a grunt
plugin. So, make sure you install GruntJS. .
Once grunt
is installed, follow the steps listed below:
$ npm init
$ npm install parata --save
grunt.initConfig({
parata: {
options: {
stylePreProcessor: 'scss'
}
}
});
grunt.loadNpmTasks('parata');
grunt.initConfig({
parata: {
options: {
}
},
sass: {
dist: {
files: {
'dist/app.dist.css': 'components/app.scss'
}
}
}
});
// Load the plugin that provides the "uglify" task.
grunt.loadNpmTasks('parata');
grunt.loadNpmTasks('grunt-contrib-sass');
$ grunt parata --init
$ grunt parata --component button
$ grunt sass
$ grunt parata --build
$ grunt parata --serve
Navigate to: http://localhost:8888/test/button
Open components/button/
in your editor.
/**
* @component button
* @description Button.
* @variants primary | secondary | default
*/
button {
color: #F5F5F5;
padding: 10px;
&:hover {
cursor: pointer;
}
&.primary {
background: blue;
}
&.secondary {
background: red;
}
&.default {
background: yellow;
}
}
/**
* Bootstrap file for all styles
*/
@import 'button/style'
<example for="button">
<button class="{{ variant }}">{{ variant }}</button>
</example>
<script for="button">
alert("Hello I'm a component!");
</script>
stylePreProcessor
: Extension of your style files. Eg.: scss
or less
.
componentsDirectory
: Path where all your components reside.
dest
: Destination where all the build files go into.
serverPort
: Default port the serve
task.