Skip to content

Commit f3a972e

Browse files
committed
Merge branch '3.0'
Merges #8
2 parents 54ceb16 + 41e5d8c commit f3a972e

18 files changed

+142
-154
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/coverage/
22
/lib/
33
/node_modules/
4-
/npm-debug.log
4+
/npm-debug.*
55
.tmp

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@
66
/.eslintrc.yml
77
/.gitignore
88
/.travis.yml
9+
/coffeelint.json

.travis.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
language: node_js
22
node_js:
33
- "6"
4-
- "5"
54
- "4"
6-
- "0.12"
7-
- "0.10"
85
after_success:
96
- npm run coveralls
107
before_deploy:
@@ -17,8 +14,8 @@ deploy:
1714
secure: YGkGJVV8Wx86+4fy8k88vLBku/JU7402q+fFS7VFLa1Lt017N9qsIasJgSiUWBsmRbp6L8FqT77yv7BZsyn3swdeFk/Uz8Le3lKQgANFAy7JQj/4MaceZsGxvuOU1+PHsFMqZDlIQpTzkaiPN6bVCj/nrxspPfTEiaDThsNPy/BNXjoPMnwvg8PuRgotJSHEx1vWlemnLql69RnfoWO0dqO1RY8To8wNjPJVQtMsOGgdDbg1Gi6FAdp3YltVbCIl9XSn0ibjo+sEPfHEhToPszlbyExm4GelocK3qCFowTE6YMO/PHNXq12oPI/mOB0VESyNeawnT6MYQYI+ClgWS8KXGaZVUuOJ3s9nkPODMjTBmx7TElPWBmNNtutOI12VxTmXKs+gKynJuEf7T9xIgunIuzDOFZR/OflT1qySQoVGeYBJCjYeG2IA0hIVcnVHmYBybVuw6ut5A1N5fORxVS+yToJRfR8IrU6dmuhd61nffoAPJ81TzOvcGIldKuN0g6wfc40EaJQr+QZgUvBPp72jffajP0DviQ3RBx0y3ktikqvetm0TuXc9FzLEkjBKJY4r2BKahTcqv9YyPI4Ui9vNvjaD2VG4Qa7HtsUNi342/uaVnRMf24/VI/UOkhgI8e2DDKH35RucLK0sxrEEUfTwqNM2jhBuNQHA+BDpyAg=
1815
skip_cleanup: true
1916
on:
20-
repo: akim-mcmath/ejs-html-loader
21-
node: "4"
17+
repo: mcmath/ejs-html-loader
18+
node: "6"
2219
tags: true
2320
after_deploy:
2421
- npm run unbuild

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2016 Akim McMath
1+
Copyright (c) 2016-2017 Akim McMath
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy of
44
this software and associated documentation files (the "Software"), to deal in

README.md

Lines changed: 22 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,47 @@
11
# ejs-html-loader
22

33
[![Version][version-badge]][npm]
4-
[![License][license-badge]][license]
54
[![Build][build-badge]][travis]
65
[![Coverage][coverage-badge]][coveralls]
76
[![Dependencies][dependencies-badge]][gemnasium]
87

9-
[Webpack][webpack] loader for rendering plain HTML from [EJS][ejs]
8+
[Webpack 2][webpack] loader for rendering plain HTML from [EJS][ejs]
109
template files
1110

1211
## Install
1312

14-
Install with [npm][npm]. And be sure to install [EJS][ejs] and
15-
[Webpack][webpack], which are peer dependencies.
13+
Install with [npm][npm]. Ensure [EJS][ejs] and [Webpack 2][webpack] are installed
14+
as well, as these are peer dependencies.
1615

1716
```sh
1817
npm install --save-dev webpack ejs ejs-html-loader
1918
```
2019

2120
## Usage
2221

23-
In your Webpack [configuration][webpack-configuration], options and locals can
24-
be passed to EJS in two ways. First, through a query string or query object:
22+
In your Webpack [configuration][webpack-configuration], pass data to your
23+
templates through either an `'options'` object or as query parameters.
2524

2625
```js
2726
module.exports = {
2827
// ...
2928
module: {
30-
loaders: [{
29+
rules: [{
3130
test: /\.ejs$/,
32-
loader: 'ejs-html?title=The%20Big%20Gatsby&production'
31+
loader: 'ejs-html-loader',
32+
options: {
33+
title: "The Ant: An Introduction",
34+
production: process.env.ENV === "production"
35+
}
3336
}]
3437
}
35-
};
36-
```
37-
38-
Or second, via an `'ejsHtml'` property:
39-
40-
```js
41-
module.exports = {
4238
// ...
43-
ejsHtml: {
44-
title: 'For Whom the Bell Rings',
45-
baseUrl: '/',
46-
delimiter: '?'
47-
}
4839
};
4940
```
5041

5142
## Options
5243

53-
All properties passed to the loader will be available to your
44+
All properties passed as loader options will be available to your
5445
templates as local variables. In addition, the following [EJS][ejs]
5546
options may be set:
5647

@@ -66,27 +57,26 @@ Defaults to `'%'`, as in `<%= some.variable %>`.
6657

6758
The EJS `filename` option is set automatically, so you may include partials
6859
relative to your template files. If you want your included files to
69-
automatically recompile in **watch mode**, be sure to use the following syntax:
60+
automatically recompile in watch mode, be sure to use the following syntax:
7061

7162
```
7263
<% include some/file %>
7364
```
7465

7566
## License
7667

77-
Copyright &copy; 2016 Akim McMath. Licensed under the [MIT License][license].
68+
Copyright &copy; 2016&ndash;2017 Akim McMath. Licensed under the [MIT License][license].
7869

7970
[version-badge]: https://img.shields.io/npm/v/ejs-html-loader.svg?style=flat-square
80-
[license-badge]: https://img.shields.io/npm/l/ejs-html-loader.svg?style=flat-square
81-
[build-badge]: https://img.shields.io/travis/akim-mcmath/ejs-html-loader/master.svg?style=flat-square
82-
[coverage-badge]: https://img.shields.io/coveralls/akim-mcmath/ejs-html-loader/master.svg?style=flat-square&service=github
83-
[dependencies-badge]: https://img.shields.io/gemnasium/akim-mcmath/ejs-html-loader.svg?style=flat-square
71+
[build-badge]: https://img.shields.io/travis/mcmath/ejs-html-loader/master.svg?style=flat-square
72+
[coverage-badge]: https://img.shields.io/coveralls/mcmath/ejs-html-loader/master.svg?style=flat-square&service=github
73+
[dependencies-badge]: https://img.shields.io/gemnasium/mcmath/ejs-html-loader.svg?style=flat-square
8474

8575
[npm]: https://www.npmjs.com/package/ejs-html-loader
8676
[license]: LICENSE
87-
[travis]: https://travis-ci.org/akim-mcmath/ejs-html-loader
88-
[coveralls]: https://coveralls.io/github/akim-mcmath/ejs-html-loader?branch=master
89-
[gemnasium]: https://gemnasium.com/akim-mcmath/ejs-html-loader
90-
[webpack]: https://webpack.github.io/
91-
[webpack-configuration]: https://webpack.github.io/docs/configuration.html
77+
[travis]: https://travis-ci.org/mcmath/ejs-html-loader
78+
[coveralls]: https://coveralls.io/github/mcmath/ejs-html-loader?branch=master
79+
[gemnasium]: https://gemnasium.com/mcmath/ejs-html-loader
80+
[webpack]: https://webpack.js.org/
81+
[webpack-configuration]: https://webpack.js.org/configuration/
9282
[ejs]: http://ejs.co/

coffeelint.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "@mcmath/coffeelint-config"
3+
}

package.json

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,21 @@
66
"scripts": {
77
"build": "npm run unbuild && babel src -d lib",
88
"unbuild": "rimraf lib",
9-
"test:lint": "eslint lib test",
9+
"test:lint": "eslint lib test && coffeelint -q test",
1010
"test:unit": "istanbul cover _mocha -- test/index.coffee",
1111
"test:report": "npm run test:unit && open coverage/lcov-report/index.html",
1212
"test": "npm run test:lint && npm run test:unit",
1313
"coveralls": "cat coverage/lcov.info | coveralls"
1414
},
1515
"engines": {
16-
"node": ">=0.10"
16+
"node": ">=4"
1717
},
1818
"repository": {
1919
"type": "git",
20-
"url": "git+https://github.com/akim-mcmath/ejs-html-loader.git"
20+
"url": "git+https://github.com/mcmath/ejs-html-loader.git"
2121
},
2222
"keywords": [
2323
"webpack",
24-
"webpack-2",
2524
"loader",
2625
"webpack-loader",
2726
"ejs",
@@ -31,32 +30,33 @@
3130
"author": "Akim McMath <[email protected]>",
3231
"license": "MIT",
3332
"bugs": {
34-
"url": "https://github.com/akim-mcmath/ejs-html-loader/issues"
33+
"url": "https://github.com/mcmath/ejs-html-loader/issues"
3534
},
36-
"homepage": "https://github.com/akim-mcmath/ejs-html-loader#readme",
35+
"homepage": "https://github.com/mcmath/ejs-html-loader#readme",
3736
"peerDependencies": {
38-
"webpack": "1.x - 2.x",
37+
"webpack": "2.x",
3938
"ejs": "2.x"
4039
},
4140
"dependencies": {
42-
"loader-utils": "^0.2.15"
41+
"loader-utils": "^1.1.0"
4342
},
4443
"devDependencies": {
45-
"babel-cli": "^6.9.0",
44+
"@mcmath/coffeelint-config": "^1.0.1",
45+
"babel-cli": "^6.24.1",
4646
"babel-plugin-add-module-exports": "^0.2.1",
47-
"babel-preset-es2015": "^6.9.0",
48-
"babel-register": "^6.9.0",
49-
"bluebird": "^3.4.0",
47+
"babel-preset-es2015": "^6.24.1",
48+
"babel-register": "^6.24.1",
5049
"chai": "^3.5.0",
51-
"coffee-script": "^1.10.0",
52-
"coveralls": "^2.11.9",
53-
"ejs": "^2.4.2",
54-
"eslint": "^2.11.1",
55-
"file-loader": "^0.8.5",
56-
"istanbul": "1.0.0-alpha.2",
57-
"mocha": "^2.5.3",
50+
"coffee-script": "^1.12.5",
51+
"coffeelint": "^1.16.0",
52+
"coveralls": "^2.13.1",
53+
"ejs": "^2.5.6",
54+
"eslint": "^3.19.0",
55+
"file-loader": "^0.11.1",
56+
"istanbul": "1.1.0-alpha.1",
57+
"mocha": "^3.3.0",
5858
"relative-path-map": "^1.0.1",
59-
"rimraf": "^2.5.2",
60-
"webpack": "^1.12.13"
59+
"rimraf": "^2.6.1",
60+
"webpack": "^2.5.1"
6161
}
6262
}

src/index.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
import {getLoaderConfig} from 'loader-utils';
1+
import {getOptions} from 'loader-utils';
22
import {addDependencies, saveDependencies} from './cache';
33
import {render} from './render';
44

55
export default function ejsHtmlLoader(src) {
66
this.cacheable();
7-
87
let rendered = '';
98

109
try {
@@ -17,7 +16,7 @@ export default function ejsHtmlLoader(src) {
1716
}
1817

1918
function renderTemplate(ctx, src) {
20-
let data = getLoaderConfig(ctx, 'ejsHtml');
19+
let data = getOptions(ctx);
2120
let {rendered, deps} = render(ctx, src, data);
2221

2322
saveDependencies(ctx, deps);

test/config/paths.coffee

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ path = require 'path'
22
pathMap = require 'relative-path-map'
33

44
module.exports = pathMap(
5-
root: path.resolve __dirname, '../..'
6-
src: '[root]/src/index.js'
7-
test: '[root]/test'
8-
fixt: '[test]/fixtures'
9-
out: '[test]/.tmp'
10-
outFile: '[out]/index.html'
5+
root: path.resolve __dirname, '../..'
6+
src: '[root]/src/index.js'
7+
test: '[root]/test'
8+
fixt: '[test]/fixtures'
9+
out: '[test]/.tmp'
10+
outFile: '[out]/index.html'
1111
)

test/fixtures/bad-locals.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
require('./bad-locals.ejs')
1+
require('./bad-locals.ejs');

0 commit comments

Comments
 (0)