slime pack 생성 함수 상세 설명 및 밤 사용

SLIME PACK은github의 전단 컴파일 항목입니다.github에서 sp-build를 검색하십시오
slime.js, css의 생산과 개발 환경에 필요한 파일을 생성합니다. 생산 환경은 자동으로 압축과hash를 가져옵니다.gulp에 익숙하지 않은 학생에게는 좋은 학습 자료일 수 있습니다. 안에 있는 원본과 구조를 보면 회사에서 프로젝트를 시작할 수 있습니다.
다음은 슬림.build 함수에 대한 상세한 설명
      
//style: ['css', 'scss', 'sass', 'less', 'stylus', 'styl']  
//templet: ['hbs', 'swig', 'htm', 'html', 'php', 'jsp']  
//script: ['js', 'jsx', 'coffee', 'cjsx']  


/*
*         
* {parm1} {string} //    ,       ,      d:\xxx\yyy.js
*         {string} //    ,config      ,  config -> pages  
*         {string} //    ,       d:\xxx  
*         {array}  //     ,     string     ['d:\xxx\yyy.js','d:\xxx\aaa.js']  
*         {json}   //   JSON*
* {parm2} {boolean}//   /  ,true=  、false=  
* {parm3} {json object}
* return stream     
*/

var slime = require('./_builder/configs/slime.config.js');
slime.build(entry, [pack], [options])  


//  、      `{key: value}`  ,vlaue   ,      json
options:
 * [rename]   :String ---      
   //   key 
   0、slime.build('./a', true, {rename: 'xxx',type: 'sass'})    //   xxx.css
   1、slime.build(['a.js','b.js'],{rename: 'xxx'})  //   xxx.js
   2、slime.build({aaa: ['a.jsx','b.js']},{rename: 'xxx'})  //   xxx.js
   3、slime.build('./abc.js',{rename: 'xxx'})  //   xxx.js

 * [type]   :String --- script    ,style/templet,       , 
   //      
   1、slime.build('./a',{type: 'sass'})
   2、slime.build('./a',{type: 'hbs'})

 * [prepend]   :Array ---      
   //value    
   1、slime.build('./a',{prepend: ['./xxx.js']})

 * [apend]   :Array ---      
   //value    
   1、slime.build('./a',{apend: ['./xxx.js']})

# css   (coffee)

config = require '../configs/config.coffee'
test = config.dirs.src + '/css/pages/website/index.scss'     #string //  index.css
ary = [                                                      #array  //       css
    config.dirs.src + '/css/pages/website/index.scss',
    config.dirs.src + '/css/pages/website/error-404.scss',
    config.dirs.src + '/css/pages/website/error-500.scss'
]
testcommon1 =  {ggggg: ary}                                  #json  //  ggggg.css
testcommon2 =  {ggggg: ary,kkkkk: test}                      #json  //  ggggg.css、kkkkk.css

module.exports = (gulp,$,slime)->
    return () ->
        slime.build(test,false,{type: 'sass'});
        # slime.build(testcommon1,false,{type: 'sass'});
        # slime.build(testcommon2,{type: 'sass'});
# js   (coffee)

config = require '../configs/config.coffee'
test = config.dirs.src + '/js/pages/h5/lazypage/lazypage.jsx'
ary = [
    config.dirs.src + '/js/pages/h5/loadpage/loadpage.jsx'
]
testcommon1 =  {ggggg: ary}
testcommon2 =  {ggggg: ary,kkkkk: test}
module.exports = (gulp,$,slime)->
    return (cb) ->
        slime.build(testcommon2,cb);

좋은 웹페이지 즐겨찾기