Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pheuter/require-j
RequireJS Jade plugin that supports client-side Jade rendering, including template inheritance.
https://github.com/pheuter/require-j
Last synced: 3 months ago
JSON representation
RequireJS Jade plugin that supports client-side Jade rendering, including template inheritance.
- Host: GitHub
- URL: https://github.com/pheuter/require-j
- Owner: pheuter
- License: mit
- Created: 2013-03-03T17:19:59.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2019-01-07T09:33:44.000Z (almost 6 years ago)
- Last Synced: 2024-04-14T09:49:45.899Z (9 months ago)
- Language: CoffeeScript
- Homepage:
- Size: 342 KB
- Stars: 7
- Watchers: 6
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# require-j
RequireJS Jade plugin that supports client-side Jade rendering, including template inheritance.
## About
**require-j** attempts to fill the gap left by porting jade over to the client, namely the ability to use template inheritance constructs such as [extends](https://github.com/visionmedia/jade#template-inheritance) and [include](https://github.com/visionmedia/jade#includes).
To load templates, jade depends on certain node modules (such as `path` and `fs`) to exist during runtime and uses `require` to access them. The [problem](https://github.com/rocketlabsdev/require-jade/issues/11) is that node's `require` is replaced by RequireJS's `require` which has no notion of node modules.
To address this issue, **require-j** overrides jade's default [parseInclude](https://github.com/visionmedia/jade/blob/master/jade.js#L3123-L3164) and [parseExtends](https://github.com/visionmedia/jade/blob/master/jade.js#L3062-L3085) functions with a variant that utilizes RequireJS APIs, such as [toUrl](http://requirejs.org/docs/plugins.html#apiload) and `fetchText`. *This is achieved without any modifications to the jade library.*
## Todo
* Refactor `load` to support dynamic loading from the browser
## Dependencies
* [Jade](https://github.com/visionmedia/jade)
## Setup
Initialize jade submodule
```sh
$ git submodule init
$ git submodule update
```Install dependencies
```sh
$ npm install
```## Build plugin and demo app
```sh
$ cake build
```*Will create `lib/j.js` and `demo/main.out.js`*
## Usage
Check out the demo app in **demo/** for a sample app utilizing **require-j**