Skip to content

Commit 831d4b0

Browse files
committed
fix: update twig support from github.com//pull/129
1 parent f69bc70 commit 831d4b0

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Diff for: src/transform/index.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ var extname = require('../extname');
44
/**
55
* Constants
66
*/
7-
var TARGET_TYPES = ['html', 'html.twig', 'jade', 'pug', 'slm', 'slim', 'jsx', 'haml', 'less', 'sass', 'scss'];
7+
var TARGET_TYPES = ['html', 'jade', 'pug', 'slm', 'slim', 'jsx', 'haml', 'less', 'sass', 'scss', 'twig'];
88
var IMAGES = ['jpeg', 'jpg', 'png', 'gif'];
99
var DEFAULT_TARGET = TARGET_TYPES[0];
1010

@@ -194,6 +194,14 @@ transform.scss.sass = transform.less.less;
194194
transform.scss.scss = transform.scss.sass;
195195
transform.scss.css = transform.scss.sass;
196196

197+
transform.twig.css = function (filepath) {
198+
return '<link rel="stylesheet" href="{{ asset("' + filepath + '") }}"' + end();
199+
};
200+
201+
transform.twig.js = function (filepath) {
202+
return '<script src="{{ asset("' + filepath + '") }}"></script>';
203+
};
204+
197205
/**
198206
* Transformations for jsx is like html
199207
* but always with self closing tags, invalid jsx otherwise

0 commit comments

Comments
 (0)