Skip to content

Instantly share code, notes, and snippets.

@BelinChung
Last active July 30, 2018 14:54
Show Gist options
  • Save BelinChung/dc83207b4bbf9ce92e53 to your computer and use it in GitHub Desktop.
Save BelinChung/dc83207b4bbf9ce92e53 to your computer and use it in GitHub Desktop.
fis config file for FIS3
/* global fis */
/**
* fis-conf.js for FIS3
* author: BelinChung
*
**/
fis.set('component.gitlab.token', 'FwUhAGn************');
fis.hook('commonjs', {
});
fis.match('::package', {
postpackager: fis.plugin('loader', {
resourceType: 'mod'
})
})
.match('*', {
domain: '/domain'
})
/**
* 语言能力拓展相关
* */
.match('*.{html,js,es6}', {
useSameNameRequire: true
})
.match('*.jsp', {
loaderLang: 'html'
})
.match('/WEB-INF/**/*.jsp', {
loaderLang: false
})
.match('**/*.less', {
rExt: '.css',
parser: fis.plugin('less-2.x')
})
.match('**/*.es6', {
rExt: '.js',
parser: fis.plugin('babel', {
presets: ['es2015'],
plugins: ['add-module-exports']
})
})
.match('*.{css,less}', {
postprocessor: fis.plugin('autoprefixer', {
'browsers': ['last 2 versions', '> 5%', 'Firefox > 20', 'ie > 8'],
'cascade': true
})
})
/**
* 模块化相关
* */
.match('/components/**/*.js', {
isMod: true
})
.match(/^\/modules\/(.*)\.(js|es6)$/i, {
id: '$1',
isMod: true
})
// 支出N层的短名引用
// 'modules/a/b/c/c.js' => require('a/b/c');
.match(/\/modules\/(((.*)\/)?([^\/]+))\/\4\.(js|es6)/i, {
id : '$1',
isMod: true
})
/**
* 基础文件的路径设置及拷贝
* */
.match(/^\/components\/(.*\.(?:png|gif))$/,{
release: 'style/img/$1'
})
.match('/style/**/*',{
release: '$0'
})
.match('/style/img/**',{
useHash: false
})
.match('/asserts/**/*',{
release: '$0'
})
.match('/WEB-INF/**/*',{
release: '$0'
});
// fis3 release prod 产品发布,进行合并
fis.media('prod')
.match('::package', {
spriter: fis.plugin('csssprites'),
postpackager: fis.plugin('loader', {
allInOne: {
css: 'pkg/web_app_${hash}.css',
js: 'pkg/web_app_${hash}.js'
}
})
})
.match('*.{css,less}', {
useSprite: true
})
.match(/^\/modules\/(.*)\/(.*\.(?:png))$/,{
release: 'style/img/$1'
})
.match('*.js', {
useHash: true,
optimizer: fis.plugin('uglify-js')
})
.match('*.css', {
useHash: true,
optimizer: fis.plugin('clean-css')
})
.match('*.png', {
optimizer: fis.plugin('png-compressor')
})
.match('/asserts/**/*.{css,js}',{
useHash: false
})
.match('/WEB-INF/**/*.{css,js}',{
useHash: false
})
/**
* 独立声明异步加载的组件
* */
.match(/^\/components\/bootstrap-tagsinput\/(.*\.(?:js))$/,{
release: 'pkg/$&'
})
.match(/^\/components\/cropper\/(.*\.(?:js))$/,{
release: 'pkg/$&'
})
.match(/^\/components\/fancybox\/(.*\.(?:js))$/,{
release: 'pkg/$&'
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment