Skip to content

Commit 0e3f94c

Browse files
author
Mohamed Cherif Bouchelaghem
authored
Merge pull request #5 from canjs/major
Major
2 parents 623e74c + 16b9b98 commit 0e3f94c

File tree

5 files changed

+17
-121
lines changed

5 files changed

+17
-121
lines changed

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22
[![dependencies](https://img.shields.io/david/macku/can-stache-loader.svg)](https://david-dm.org/macku/can-stache-loader)
33
[![dev dependencies](https://img.shields.io/david/dev/macku/can-stache-loader.svg)](https://david-dm.org/macku/can-stache-loader?type=dev)
44

5+
<div align="center">
6+
<a href="https://github.com/webpack/webpack">
7+
<img width="200" height="200"
8+
src="https://webpack.js.org/assets/icon-square-big.svg">
9+
</a>
10+
</div>
11+
512
# CanJS Stache template loader for webpack
613

714
Compiles [CanJS Stache](https://github.com/canjs/can-stache) templates with [can-view-parser](https://github.com/canjs/can-view-parser) and allows to load them with [webpack](https://webpack.github.io/)
@@ -28,6 +35,8 @@ yarn add can-stache-loader
2835

2936
### Configure webpack 2+
3037

38+
**webpack.config.js**
39+
3140
```js
3241
{
3342
module: {
@@ -46,7 +55,8 @@ yarn add can-stache-loader
4655
### Import stache templates in your [CanJS](https://canjs.com/) project
4756

4857
```js
49-
const tpl = require('./template.stache');
58+
import tpl from './template.stache';
59+
5060
const html = tpl({
5161
foo: 'bar'
5262
});

clean-line-endings.js

Lines changed: 0 additions & 47 deletions
This file was deleted.

index.js

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
1-
const getIntermediateAndImports = require('./intermediate_and_imports');
2-
// const getIntermediateAndImports = require('can-stache/src/intermediate_and_imports');
3-
// const getIntermediateAndImports = require('can/dist/cjs/view/stache/intermediate_and_imports');
4-
1+
const getIntermediateAndImports = require('can-stache/src/intermediate_and_imports');
52

63
const getTemplate = (source, imports) => {
74
const requires = imports.map(i => `require('${i}');`).join('\n');
85

9-
return `var stache = require('can/dist/cjs/view/stache/stache');
10-
var mustacheCore = require('can/dist/cjs/view/stache/mustache_core');
11-
var getIntermediateAndImports = require('can/dist/cjs/view/stache/intermediate_and_imports');
6+
return `var stache = require('can-stache');
7+
var mustacheCore = require('can-stache/src/mustache_core');
8+
var getIntermediateAndImports = require('can-stache/src/intermediate_and_imports');
129
1310
${requires}
1411
@@ -27,11 +24,10 @@ module.exports = function (scope, options, nodeList) {
2724
2825
return renderer(scope, options.add(moduleOptions), nodeList);
2926
};`;
30-
}
27+
};
3128

3229
module.exports = function canStacheLoader(source) {
3330
const src = JSON.stringify(source);
34-
3531
const intermediateAndImports = getIntermediateAndImports(source);
3632

3733
return getTemplate(src, intermediateAndImports.imports);

intermediate_and_imports.js

Lines changed: 0 additions & 62 deletions
This file was deleted.

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "can-stache-loader",
3-
"version": "0.2.1",
3+
"version": "1.0.0",
44
"description": "CanJS Stache loader for WebPack",
55
"main": "index.js",
66
"scripts": {
@@ -20,7 +20,6 @@
2020
"mustache"
2121
],
2222
"dependencies": {
23-
"can": "^2.3.31",
2423
"can-stache": "^3.0.25",
2524
"can-view-parser": "^3.3.0"
2625
},

0 commit comments

Comments
 (0)