Initial commit.

This commit is contained in:
Dmitriy Kubyshkin 2014-12-15 15:48:11 +01:00
commit 55196028f5
5 changed files with 106 additions and 0 deletions

25
.npmignore Normal file
View File

@ -0,0 +1,25 @@
# Logs
logs
*.log
# Runtime data
pids
*.pid
*.seed
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release
# Dependency directory
# Deployed apps should consider commenting this line out:
# see https://npmjs.org/doc/faq.html#Should-I-check-my-node_modules-folder-into-git
node_modules

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2014 Andrey Okonetchnikov
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

26
README.md Normal file
View File

@ -0,0 +1,26 @@
# ejs-loader for webpack
EJS (Underscore/LoDash Templates) loader for [webpack](http://webpack.github.io/). Uses [lodash template](http://lodash.com/docs#template) function to compile templates.
## Installation
`npm install ejs-loader`
## Usage
[Documentation: Using loaders](http://webpack.github.io/docs/using-loaders.html)
``` javascript
var template = require("ejs!./file.ejs");
// => returns the template function compiled with undesrcore (lodash) templating engine.
// And then use it somewhere in your code
template(data) // Pass object with data
```
## License
MIT (http://www.opensource.org/licenses/mit-license.php)

7
index.js Normal file
View File

@ -0,0 +1,7 @@
var _ = require('underscore');
module.exports = function (source) {
this.cacheable && this.cacheable();
var template = _.template(source);
return 'module.exports = ' + template;
};

27
package.json Normal file
View File

@ -0,0 +1,27 @@
{
"name": "tpl-loader",
"version": "0.1.0",
"description": "Underscore Templates loader for webpack",
"main": "index.js",
"repository": {
"type": "git",
"url": "https://github.com/grassator/tpl-loader.git"
},
"keywords": [
"ejs",
"underscrore",
"lodash",
"_",
"webpack",
"loader",
"template"
],
"author": {
"name": "Dmitriy Kubyshkin",
"email": "dmitriy@kubyshkin.ru"
},
"license": "MIT",
"peerDependencies": {
"lodash": "*"
}
}