Set new build system as default (#3348)
This commit is contained in:
parent
60e04c82a9
commit
4e690ba8bd
2 changed files with 24 additions and 28 deletions
|
|
@ -23,42 +23,40 @@ def setup():
|
|||
except ImportError: pass
|
||||
app_paths = [os.path.dirname(pymodule.__file__) for pymodule in pymodules]
|
||||
|
||||
def bundle(no_compress, make_copy=False, verbose=False, beta=False):
|
||||
def bundle(no_compress, make_copy=False, verbose=False):
|
||||
"""concat / minify js files"""
|
||||
# build js files
|
||||
setup()
|
||||
|
||||
make_asset_dirs(make_copy=make_copy)
|
||||
|
||||
if beta:
|
||||
command = 'node ../apps/frappe/frappe/build.js --build'
|
||||
if not no_compress:
|
||||
command += ' --minify'
|
||||
subprocess.call(command.split(' '))
|
||||
return
|
||||
# new nodejs build system
|
||||
command = 'node ../apps/frappe/frappe/build.js --build'
|
||||
if not no_compress:
|
||||
command += ' --minify'
|
||||
subprocess.call(command.split(' '))
|
||||
|
||||
build(no_compress, verbose)
|
||||
# build(no_compress, verbose)
|
||||
|
||||
def watch(no_compress, beta=False):
|
||||
def watch(no_compress):
|
||||
"""watch and rebuild if necessary"""
|
||||
|
||||
if beta:
|
||||
command = 'node ../apps/frappe/frappe/build.js --watch'
|
||||
subprocess.Popen(command.split(' '))
|
||||
return
|
||||
# new nodejs file watcher
|
||||
command = 'node ../apps/frappe/frappe/build.js --watch'
|
||||
subprocess.call(command.split(' '))
|
||||
|
||||
setup()
|
||||
# setup()
|
||||
|
||||
import time
|
||||
compile_less()
|
||||
build(no_compress=True)
|
||||
# import time
|
||||
# compile_less()
|
||||
# build(no_compress=True)
|
||||
|
||||
while True:
|
||||
compile_less()
|
||||
if files_dirty():
|
||||
build(no_compress=True)
|
||||
# while True:
|
||||
# compile_less()
|
||||
# if files_dirty():
|
||||
# build(no_compress=True)
|
||||
|
||||
time.sleep(3)
|
||||
# time.sleep(3)
|
||||
|
||||
def make_asset_dirs(make_copy=False):
|
||||
assets_path = os.path.join(frappe.local.sites_path, "assets")
|
||||
|
|
|
|||
|
|
@ -8,21 +8,19 @@ from frappe.commands import pass_context, get_site
|
|||
@click.command('build')
|
||||
@click.option('--make-copy', is_flag=True, default=False, help='Copy the files instead of symlinking')
|
||||
@click.option('--verbose', is_flag=True, default=False, help='Verbose')
|
||||
@click.option('--beta', is_flag=True, default=False, help='Use the new NodeJS build system')
|
||||
def build(make_copy=False, verbose=False, beta=False):
|
||||
def build(make_copy=False, verbose=False):
|
||||
"Minify + concatenate JS and CSS files, build translations"
|
||||
import frappe.build
|
||||
import frappe
|
||||
frappe.init('')
|
||||
frappe.build.bundle(False, make_copy=make_copy, verbose=verbose, beta=beta)
|
||||
frappe.build.bundle(False, make_copy=make_copy, verbose=verbose)
|
||||
|
||||
@click.command('watch')
|
||||
@click.option('--beta', is_flag=True, default=False, help='Use the new NodeJS build system')
|
||||
def watch(beta=False):
|
||||
def watch():
|
||||
"Watch and concatenate JS and CSS files as and when they change"
|
||||
import frappe.build
|
||||
frappe.init('')
|
||||
frappe.build.watch(True, beta=beta)
|
||||
frappe.build.watch(True)
|
||||
|
||||
@click.command('clear-cache')
|
||||
@pass_context
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue