Coder Social home page Coder Social logo

make-rails's Introduction

make-rails

Build your Rails assets with anything

make-rails allows you to plug in anything to build your assets, whether that be Node.js tools (node-sass, webpack, et al) or anything else.

Usage

Add this to your Gemfile. make-rails will register itself as a Sprockets transformation step.

Gemfile
gem 'make-rails'

Create your assets

Create your .css and .js assets with a make directive. make-rails will pick this up and run it as a transformation for your file. Use %s as a placeholder for the current filename.

The command it executes should print its output to STDOUT.

app/assets/stylesheets/app.css
/*
 *= make sassc -I ../../../node_modules %s | postcss -u autoprefixer
 */

@import 'normalize/normalize.css';
@import './foo';

div {
  color: blue;
}

Examples

Browserify

An example app/assets/javascripts/application.js with Babel support:

//= make browserify %s -t babelify

import $ from 'jquery'

$(function () {
  alert('It works!')
})

Stylus

An example app/assets/stylesheets/application.css with Stylus and postcss support:

//= make stylus --compress %s --include-css | postcss -u rucksack

Development

For commands to be ran on development, use make_dev. Use this to inject some extra tools. In this example, we'll use browserify-inc to produce faster incremental builds, and browserify-hmr for fast module reloading.

//= make browserify %s -t babelify
//= make_dev browserify-inc %s -t babelify -t browserify-hmr

...

Todo

This doesn't exist yet; this README is simply a draft of the proposed API.

make-rails's People

Contributors

rstacruz avatar

Stargazers

 avatar  avatar  avatar

Watchers

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