Giter VIP home page Giter VIP logo

require-jade's Introduction

require-jade

A Jade loader plugin for RequireJS.

It is known to work with RequireJS 0.26.0+.

In development, it uses XMLHttpRequest to fetch the .jade files, so you can only fetch files that are on the same domain as the HTML page, and most browsers place restrictions on using XMLHttpRequest from local file URLs, so use a web server to serve your .jade files.

Usage

Reference Jade files via the jade! plugin name:

require(['jade!userview'], function (userView) {
  $('.user').html(userView(locals));
});

They will be returned as a Jade template function that accepts locals as the first arg.

Optimizing

When you are ready to deploy your application and want to compile your JS into a single file you can make used of the requireJS optimizer. Jade.js includes optimizer instructions that will precompile the templates and remove the Jade compiler from the compiled source. Only do this if you are not going to be dynamically including more Jade templates.

To use the activate the instructions just include:

pragmasOnSave: {
  excludeJade : true
}

License

Available via the MIT or new BSD license.

The Jade parts are governed by the Jade license.

require-jade's People

Contributors

deedubs avatar lbdremy avatar paulwe avatar rush avatar vincentmac avatar

Watchers

 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.