Skip to content
This repository has been archived by the owner on Feb 24, 2018. It is now read-only.

Rename to pug-loader #4

Merged
merged 1 commit into from
Dec 23, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# jade-load
# pug-loader

The jade loader is responsible for loading the depenendencies of a given jade file. It adds `fullPath` and `str` properties to every `Include` and `Extends` node. It also adds an `ast` property to any `Include` nodes that are loading jade and any `Extends` nodes. It then recursively loads the dependencies of any of those included files.
The pug loader is responsible for loading the depenendencies of a given pug file. It adds `fullPath` and `str` properties to every `Include` and `Extends` node. It also adds an `ast` property to any `Include` nodes that are loading pug and any `Extends` nodes. It then recursively loads the dependencies of any of those included files.

[![Build Status](https://img.shields.io/travis/jadejs/jade-load/master.svg)](https://travis-ci.org/jadejs/jade-load)
[![Dependency Status](https://img.shields.io/gemnasium/jadejs/jade-load.svg)](https://gemnasium.com/jadejs/jade-load)
[![NPM version](https://img.shields.io/npm/v/jade-load.svg)](https://www.npmjs.org/package/jade-load)
[![Build Status](https://img.shields.io/travis/pugjs/pug-loader/master.svg)](https://travis-ci.org/pugjs/pug-loader)
[![Dependency Status](https://img.shields.io/gemnasium/pugjs/pug-loader.svg)](https://gemnasium.com/pugjs/pug-loader)
[![NPM version](https://img.shields.io/npm/v/pug-loader.svg)](https://www.npmjs.org/package/pug-loader)

## Installation

npm install jade-load
npm install pug-loader

## Usage

Expand Down Expand Up @@ -58,14 +58,14 @@ This function is not meant to be called from outside of `jade-load`, but rather

```js
var fs = require('fs');
var lex = require('jade-lexer');
var parse = require('jade-parser');
var load = require('jade-load');
var lex = require('pug-lexer');
var parse = require('pug-parser');
var load = require('pug-loader');

// you can do everything very manually

var str = fs.readFileSync('bar.jade', 'utf8');
var ast = load(parse(lex(str, 'bar.jade'), 'bar.jade'), {
var str = fs.readFileSync('bar.pug', 'utf8');
var ast = load(parse(lex(str, 'bar.pug'), 'bar.pug'), {
lex: lex,
parse: parse,
resolve: function (filename, source, options) {
Expand All @@ -76,8 +76,8 @@ var ast = load(parse(lex(str, 'bar.jade'), 'bar.jade'), {

// or you can do all that in just two steps

var str = fs.readFileSync('bar.jade', 'utf8');
var ast = load.string(str, 'bar.jade', {
var str = fs.readFileSync('bar.pug', 'utf8');
var ast = load.string(str, 'bar.pug', {
lex: lex,
parse: parse,
resolve: function (filename, source, options) {
Expand All @@ -88,7 +88,7 @@ var ast = load.string(str, 'bar.jade', {

// or you can do all that in only one step

var ast = load.file('bar.jade', {
var ast = load.file('bar.pug', {
lex: lex,
parse: parse,
resolve: function (filename, source, options) {
Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

var fs = require('fs');
var path = require('path');
var walk = require('jade-walk');
var walk = require('pug-walk');

module.exports = load;
function load(ast, options) {
Expand Down
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
{
"name": "jade-load",
"name": "pug-loader",
"version": "0.0.4",
"description": "The jade loader is responsible for loading the depenendencies of a given jade file.",
"description": "The pug loader is responsible for loading the depenendencies of a given pug file.",
"keywords": [
"jade"
"pug"
],
"dependencies": {
"jade-walk": "0.0.3"
"pug-walk": "0.0.3"
},
"devDependencies": {
"jade-lexer": "0.0.9",
"jade-parser": "0.0.9"
"pug-lexer": "^1.0.0",
"pug-parser": "^1.0.0"
},
"scripts": {
"test": "node test"
},
"repository": {
"type": "git",
"url": "https://github.com/jadejs/jade-load.git"
"url": "https://github.com/pugjs/pug-loader.git"
},
"author": "ForbesLindesay",
"license": "MIT"
Expand Down
File renamed without changes.
File renamed without changes.
34 changes: 17 additions & 17 deletions test/expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
"type": "Extends",
"file": {
"type": "FileReference",
"path": "bar.jade",
"path": "bar.pug",
"line": 1,
"filename": "<dirname>/foo.jade",
"fullPath": "<dirname>/bar.jade",
"filename": "<dirname>/foo.pug",
"fullPath": "<dirname>/bar.pug",
"str": "block bing\n",
"ast": {
"type": "Block",
Expand All @@ -17,17 +17,17 @@
"type": "NamedBlock",
"nodes": [],
"line": 1,
"filename": "<dirname>/bar.jade",
"filename": "<dirname>/bar.pug",
"name": "bing",
"mode": "replace"
}
],
"line": 0,
"filename": "<dirname>/bar.jade"
"filename": "<dirname>/bar.pug"
}
},
"line": 1,
"filename": "<dirname>/foo.jade"
"filename": "<dirname>/foo.pug"
},
{
"type": "NamedBlock",
Expand All @@ -37,9 +37,9 @@
"file": {
"type": "FileReference",
"line": 4,
"filename": "<dirname>/foo.jade",
"path": "bing.jade",
"fullPath": "<dirname>/bing.jade",
"filename": "<dirname>/foo.pug",
"path": "bing.pug",
"fullPath": "<dirname>/bing.pug",
"str": ".bing bong\n",
"ast": {
"type": "Block",
Expand All @@ -55,11 +55,11 @@
"type": "Text",
"val": "bong",
"line": 1,
"filename": "<dirname>/bing.jade"
"filename": "<dirname>/bing.pug"
}
],
"line": 1,
"filename": "<dirname>/bing.jade"
"filename": "<dirname>/bing.pug"
},
"attrs": [
{
Expand All @@ -71,29 +71,29 @@
"attributeBlocks": [],
"isInline": false,
"line": 1,
"filename": "<dirname>/bing.jade"
"filename": "<dirname>/bing.pug"
}
],
"line": 0,
"filename": "<dirname>/bing.jade"
"filename": "<dirname>/bing.pug"
}
},
"line": 4,
"filename": "<dirname>/foo.jade",
"filename": "<dirname>/foo.pug",
"block": {
"type": "Block",
"nodes": [],
"line": 4,
"filename": "<dirname>/foo.jade"
"filename": "<dirname>/foo.pug"
}
}
],
"line": 3,
"filename": "<dirname>/foo.jade",
"filename": "<dirname>/foo.pug",
"name": "bing",
"mode": "replace"
}
],
"line": 0,
"filename": "<dirname>/foo.jade"
"filename": "<dirname>/foo.pug"
}
4 changes: 0 additions & 4 deletions test/foo.jade

This file was deleted.

4 changes: 4 additions & 0 deletions test/foo.pug
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
extends bar.pug

block bing
include bing.pug
8 changes: 4 additions & 4 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
var fs = require('fs');
var path = require('path');
var assert = require('assert');
var walk = require('jade-walk');
var lex = require('jade-lexer');
var parse = require('jade-parser');
var walk = require('pug-walk');
var lex = require('pug-lexer');
var parse = require('pug-parser');
var load = require('../');

var filename = __dirname + '/foo.jade';
var filename = __dirname + '/foo.pug';
var ast = load.file(filename, {
lex: lex,
parse: parse
Expand Down