Code Monkey home page Code Monkey logo

prefab-patterns's Introduction

Prefab Patterns

Build Status Code Climate Test Coverage Dependency Status

Use the prefab-patterns gem to import design patterns into your rails app from the command line. All the patterns are imported from prefab patterns marketplace. The patterns are very opinionated; from their file location to the markup itself. The objective of the prefab-patterns-gem and prefab-patterns-marketplace are to encourage scalability of an app, the standardization of patterns via views, and to be able to generate a true living style guide. No more copy pasta.

We got our idea for rendering design patterns using a method from Mountain View, and the notion for pre-made design patterns from Refills.

Installation

Add this line to your application's Gemfile:

gem "prefab_patterns", git: 'git://github.com/jasonramirez/prefab-patterns.git'

And then execute:

$ bundle

Usage

Import a pattern

With prefab_patterns you can import a pattern directly into your rails app. The directory structure is highly opinionated, so at this time we don't allow for any customization of file placement.

To import a pattern into your rails app from the command line:

$ prefab_patterns import pattern_name

Will create these files:

  • app/views/patterns/pattern_name.html.erb

  • app/assets/scripts/patterns/pattern_name.coffee

  • app/assets/styles/patterns/pattern_name.scss

  • Importing a pattern will overwrite files without warning.

Render a pattern

We use a helper method to render a design pattern into your markup. You pass locales to populate the content of the pattern:

<%= render_pattern(:card, title: "title", text: "some text"); %>
<%= object.each do %>
  <%= render_pattern(:card, title: object.title, text: object.text); %>
<% end %>

Generate Your Style guide (not available yet)

You can generate a style guide that will show you all of the patterns in your application. Generate the routes for the style guide with the following command line command:

$ patterns generate style_guide

Will create these files:

  • app/controllers/patterns_controller.rb

  • app/views/patterns/style_guide.html.erb

And modify:

  • routes.rb

Project Management

We are using this repo's Github issues to manage features in the works, feature requests, bugs and all questions related to this gem.

Known issues

This gem is currently at version 0.0.1 so use at your own risk.

  • Importing a pattern will overwrite files without warning.

Contributing

  1. Fork it ( https://github.com/[my-github-username]/prefab-patterns/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

prefab-patterns's People

Contributors

jasonramirez avatar

Watchers

James Cloos avatar  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.