UNPKG

832 BJavaScriptView Raw
1/**
2 * 获取编译方法
3 *
4 * @param {object} option
5 * @param {string} type 文件扩展名,例如:“.svg”或“_sprite”精灵图
6 *
7 * @memberOf Watch
8 */
9module.exports = (type)=>{
10 let api = require('../api'),
11 UpdateImg = require('./updateImg'),
12 fns = {
13 '.pug':api.Pug2html,
14 '.jade':api.Pug2html,
15 '.scss':api.Sass2css,
16 '.sass':api.Sass2css,
17 '.ts':api.Es2,
18 // '.d.ts':api.Es2,
19 '.tsx':api.Es2,
20 '.es':api.Es2,
21 '.es6':api.Es2,
22 '.js':api.js2js,
23 '.jsx':api.Es2,
24 '.html':api.html2html,
25 '.htm':api.html2html,
26 '_sprite':api.OutSprite,
27 '_img':UpdateImg
28 };
29 return fns[type] === undefined ? api.Copy : fns[type];
30};
\No newline at end of file