@@ -31,7 +31,7 @@ const defaultConfig = require('../patternlab-config.json');
3131
3232let fs = require ( 'fs-extra' ) ; // eslint-disable-line
3333let ui_builder = require ( './lib/ui_builder' ) ; // eslint-disable-line
34- let assetCopier = require ( './lib/asset_copy ' ) ; // eslint-disable-line
34+ let copier = require ( './lib/copier ' ) ; // eslint-disable-line
3535let pattern_exporter = new pe ( ) ; // eslint-disable-line
3636let serve = require ( './lib/serve' ) ; // eslint-disable-line
3737
@@ -369,29 +369,27 @@ const patternlab_module = function(config) {
369369 patternlab . isBusy = true ;
370370 return buildPatterns ( options . cleanPublic , options . data ) . then ( ( ) => {
371371 return new ui_builder ( ) . buildFrontend ( patternlab ) . then ( ( ) => {
372- assetCopier ( ) . copyAssets (
373- patternlab . config . paths ,
374- patternlab ,
375- options
376- ) ;
377-
378- this . events . on ( 'patternlab-pattern-change' , ( ) => {
379- if ( ! patternlab . isBusy ) {
380- return this . build ( options ) ;
381- }
382- return Promise . resolve ( ) ;
383- } ) ;
384-
385- this . events . on ( 'patternlab-global-change' , ( ) => {
386- if ( ! patternlab . isBusy ) {
387- return this . build (
388- Object . assign ( { } , options , { cleanPublic : true } ) // rebuild everything
389- ) ;
390- }
391- return Promise . resolve ( ) ;
392- } ) ;
393-
394- patternlab . isBusy = false ;
372+ copier ( )
373+ . copyAndWatch ( patternlab . config . paths , patternlab , options )
374+ . then ( ( ) => {
375+ this . events . on ( 'patternlab-pattern-change' , ( ) => {
376+ if ( ! patternlab . isBusy ) {
377+ return this . build ( options ) ;
378+ }
379+ return Promise . resolve ( ) ;
380+ } ) ;
381+
382+ this . events . on ( 'patternlab-global-change' , ( ) => {
383+ if ( ! patternlab . isBusy ) {
384+ return this . build (
385+ Object . assign ( { } , options , { cleanPublic : true } ) // rebuild everything
386+ ) ;
387+ }
388+ return Promise . resolve ( ) ;
389+ } ) ;
390+
391+ patternlab . isBusy = false ;
392+ } ) ;
395393 } ) ;
396394 } ) ;
397395 } ,
0 commit comments