#NEWLINE# @ task ( aliases = [ 'pack' ] ) #NEWLINE# def webpack( clean = False , watch = False , dev = False ) : #NEWLINE# #INDENT# 'Build static assets with webpack.' #NEWLINE# if clean : #NEWLINE# #INDENT# clean_assets ( ) #NEWLINE# #UNINDENT# if ( os . getcwd ( ) != HERE ) : #NEWLINE# #INDENT# os . chdir ( HERE ) #NEWLINE# #UNINDENT# webpack_bin = os . path . join ( HERE , 'node_modules' , 'webpack' , 'bin' , 'webpack.js' ) #NEWLINE# args = [ webpack_bin ] #NEWLINE# if ( settings . DEBUG_MODE and dev ) : #NEWLINE# #INDENT# args += [ '--colors' ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# args += [ '--progress' ] #NEWLINE# #UNINDENT# if watch : #NEWLINE# #INDENT# args += [ '--watch' ] #NEWLINE# #UNINDENT# config_file = ( 'webpack.admin.config.js' if dev else 'webpack.prod.config.js' ) #NEWLINE# args += [ '--config {0}' . format ( webpack_bin ) ] #NEWLINE# command = ' ' . join ( args ) #NEWLINE# run ( command , echo = True )