GithubHelp home page GithubHelp logo

afamyial / parata Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cybrilla/parata

0.0 2.0 0.0 136 KB

Component based style guide generator for HTML / CSS / JS

License: MIT License

JavaScript 86.39% Handlebars 12.99% HTML 0.14% Smarty 0.48%

parata's Introduction

Parata

Circle CI Code Climate

Component based styles for the web. Parata enforces you to build re-usable components for the web and generates a component wise styleguide.

Getting Started

Parata is packaged as a grunt plugin. So, make sure you install GruntJS. .

Once grunt is installed, follow the steps listed below:

Initialize an empty npm project

$ npm init

Install Parata

$ npm install parata --save

Add Parata to Gruntfile.js

  grunt.initConfig({
    parata: {
      options: {
        stylePreProcessor: 'scss'
      }
    }
  });
  
grunt.loadNpmTasks('parata');

Configure sass / less

  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');

Initialize Parata

$ grunt parata --init

Create a component

$ grunt parata --component button

Compile sass / less

$ grunt sass

Build components

$ grunt parata --build

Preview your component

$ grunt parata --serve

Navigate to: http://localhost:8888/test/button

Quick example

Open components/button/ in your editor.

Add some styling

/**
  * @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;
  }
}

Import the component to components/app.scss

/**
  * Bootstrap file for all styles
  */

  @import 'button/style'

Create an HTML sample / example for the component in example.html

<example for="button">
<button class="{{ variant }}">{{ variant }}</button>
</example>

Create a javascript snippet for the component in example.html

<script for="button">
alert("Hello I'm a component!");
</script>

Customize options

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.

parata's People

Contributors

swaroopsm avatar

Watchers

James Cloos avatar Ankit Famyial avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.