123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128 |
- var version = '';
- var path = '/common/';
- fis.set('project.files', ['*.html', 'map.json', '*.js']);
- fis.set('project.exclude', ['tpl/**.tmpl', '_dest/**']);
- fis.hook('commonjs', {
- baseUrl: './src/modules',
- extList: ['.js']
- });
- // 开启同名依赖
- fis.match('/src/dwUDBBind/*.js', {
- parser: fis.plugin('babel-5.x', {
- blacklist: ["useStrict"],
- loose: true,
- ignore: ["jQuery", "nicescroll"]
- })
- });
- fis.match('/src/modules/**', {
- useSameNameRequire: true,
- parser: fis.plugin('babel-5.x', {
- blacklist: ["useStrict"],
- loose: true,
- ignore: ["jQuery", "nicescroll"]
- })
- });
- fis.match('/lib/**.js', {
- release: version + '/$1',
- packTo: 'lib.js'
- });
- // 允许你在 js 中直接 require css+文件
- fis.match('*.{js,es}', {
- preprocessor: [
- fis.plugin('js-require-file'),
- fis.plugin('js-require-css', {
- mode: 'dependency'
- })
- ]
- });
- /*设置发布路径*/
- fis.match(/^\/src\/(.*)/i, {
- release: version + '/$1',
- // url: version + '/$1'
- });
- // 配置图片压缩
- fis.match('**.png', {
- optimizer: fis.plugin('png-compressor', {
- type: 'pngquant'
- })
- });
- /*Sprite背景图移到staticPub/images*/
- fis.match(/^\/sass\/(.*\.(png|jpg|gif|jpeg))$/i, {
- release: 'img/sprite/$1',
- url: 'img/sprite/$1'
- });
- fis.match('**.scss', {
- rExt: '.css',
- useSprite: true,
- parser: fis.plugin('node-sass'),
- postprocessor: fis.plugin('autoprefixer', {
- browsers: ['> 1%', 'last 2 versions'],
- cascade: true
- }),
- release: false
- })
- /*对CSS中的图片进行合并,包括html中的内联样式*/
- fis.match('*.{css,html,tpl}', {
- useSprite: true,
- });
- fis.match('*.tmpl', {
- isJsLike: true,
- release: false,
- parser: fis.plugin('utc')
- })
- // fis.match(/^\/src\/modules\/(.*\.js)$/i, {
- // isMod: true
- // });
- /*css压缩*/
- fis.match('*.css', {
- optimizer: fis.plugin('clean-css')
- });
- /*启用 fis-spriter-csssprites 插件*/
- fis.match('::package', {
- spriter: fis.plugin('csssprites', {
- margin: 20,
- htmlUseSprite: true,/*开启模板内联css处理*/
- styleReg: /(<style(?:(?=\s)[\s\S]*?["'\s\w\/\-]>|>))([\s\S]*?)(<\/style\s*>|$)/ig
- }),
- postpackager: fis.plugin('loader', {
- resourceType: 'commonJs',
- useInlineMap: false // 资源映射表内嵌
- })
- });
- /*图片文件域名配置*/
- fis.media('dev').match('*.{jpg,png,jpeg,gif,css,js}', {
- domain: '../../',
- });
- fis.media('prod').match('*.{jpg,png,jpeg,gif,css,scss,js,woff,ttf,svg,eot}', {
- domain: 'http://pub.ouj.com' + path,
- }).match('*.{css,png,jpg,gif,swf}', {
- useHash: true
- }).match('**.js', {
- optimizer: fis.plugin('uglify-js')
- }).match(/^\/src\/modules\/(.*\.js)$/i, {
- useHash: false,
- release: false
- }).match(/^\/sass\/((.*)\.(css|less|scss|sass))$/i, {
- url: version + 'css/$1',
- optimizer: fis.plugin('clean-css'),
- useHash: true
- }).match('sass/(**.png)', {
- release: version + 'img/sprite/$1'
- })
|