Skip to content

Commit 3fc4530

Browse files
authored
Merge pull request #30 from posthtml/milestone-1.3.1
Milestone 1.3.1
2 parents b12dfbf + 970021d commit 3fc4530

4 files changed

Lines changed: 15 additions & 58 deletions

File tree

index.js

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
var parser = require('posthtml-parser');
21
var fs = require('fs');
32
var path = require('path');
43

@@ -13,26 +12,14 @@ module.exports = function(options) {
1312
var content;
1413
var subtree;
1514
var source;
16-
1715
if (src) {
1816
src = path.resolve(options.root, src);
1917
source = fs.readFileSync(src, options.encoding);
20-
subtree = parser(source);
18+
subtree = tree.parser(source);
2119
subtree.match = tree.match;
20+
subtree.parser = tree.parser;
2221
content = source.indexOf('include') !== -1? posthtmlInclude(subtree): subtree;
2322

24-
if (
25-
typeof options.addDependencyTo === 'object' &&
26-
typeof options.addDependencyTo.addDependency === 'function'
27-
) {
28-
console.warn([
29-
"addDependencyTo is deprecated in favor of",
30-
"result.messages.dependency; posthtml-loader >= v1.0.1 will",
31-
"automatically add your imported files to webpack's file watcher."
32-
].join("\n"));
33-
options.addDependencyTo.addDependency(src);
34-
}
35-
3623
if (tree.messages) {
3724
tree.messages.push({
3825
type: "dependency",

package-lock.json

Lines changed: 10 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
{
22
"name": "posthtml-include",
3-
"version": "1.3.0",
3+
"version": "1.3.1",
44
"description": "Include file in HTML",
55
"main": "index.js",
66
"dependencies": {
7-
"posthtml-parser": "^0.4.1"
87
},
98
"devDependencies": {
109
"chai": "^4.2.0",
1110
"istanbul": "^0.4.5",
1211
"jscs": "^3.0.7",
1312
"jshint": "^2.8.0",
14-
"mocha": "^6.2.1",
15-
"posthtml": "^0.11.3"
13+
"mocha": "^6.2.2",
14+
"posthtml": "^0.12.0"
1615
},
1716
"scripts": {
1817
"test": "npm run lint && mocha -R dot && npm run cover",

test/test.js

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -43,23 +43,6 @@ describe('Simple test', function() {
4343
);
4444
});
4545

46-
it('addDependencyTo option', function(done) {
47-
var includePath = require('path').resolve('./test/blocks/button/button.html');
48-
49-
function test(filePath) {
50-
try {
51-
expect(filePath).to.eql(includePath);
52-
done();
53-
} catch(err) {
54-
done(err);
55-
}
56-
}
57-
58-
posthtml()
59-
.use(plugin({ addDependencyTo: { addDependency: test }}))
60-
.process('<include src="./test/blocks/button/button.html">');
61-
});
62-
6346
it('messages dependency for addDependency', function(done) {
6447
var includePath = require('path').resolve('./test/blocks/button/button.html');
6548

0 commit comments

Comments
 (0)