8000 GitHub - yivo/pug-rails at 2.0.0
[go: up one dir, main page]

Skip to content
/ pug-rails Public

👌 Make Jade and Pug play well with Sprockets.

License

Notifications You must be signed in to change notification settings

yivo/pug-rails

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pug/Jade template engine integration with Rails asset pipeline

About

This gem uses pug-ruby to compile Pug/Jade templates. Please refer to that gem if you want to use Pug/Jade compiler directly.

Installing gem

Add to your Gemfile:

gem 'pug-rails', '~> 2.0'

Installing Jade

Install Jade globally via npm:

npm install -g jade

Require Jade runtime.js:

//= require jade/runtime

Use .jst.jade as extension of your Jade files.

Installing Pug

Install Pug globally via npm:

npm install -g pug-cli

Require Pug runtime.js:

//= require pug/runtime

NOTE: You don't need to do this if you are inlining Pug runtime functions in template. Please read about inlineRuntimeFunctions option at official website — pugjs.org.

Use .jst.pug as extension of your Pug files.

Configuring Pug and Jade

Access Pug and Jade configurations directly:

Jade.config.compile_debug = false
Pug.config.compile_debug  = false

Access Pug and Jade configurations through Rails.application.config:

Rails.application.config.jade.compile_debug = false
Rails.application.config.pug.compile_debug  = false

Configuring asset lookup paths

It doesn't matter where to put Pug/Jade files but don't forget to update asset lookup paths. Personally I prefer to put templates in app/assets/templates:

# Add app/assets/templates to asset lookup paths
# Add this to your initializers or application.rb
Rails.application.config.assets.paths << Rails.root.join('app/assets/templates')

Running Tests

Refer to pug-ruby

Versioning

Prior to version 2.0 version of the gem was the same as the version of the Jade runtime that it contains.

0