@@ -13,7 +13,7 @@ import os, sys, importlib, inspect, json | |||||
from .exceptions import * | from .exceptions import * | ||||
from .utils.jinja import get_jenv, get_template, render_template | from .utils.jinja import get_jenv, get_template, render_template | ||||
__version__ = '8.0.49' | |||||
__version__ = '8.0.50' | |||||
__title__ = "Frappe Framework" | __title__ = "Frappe Framework" | ||||
local = Local() | local = Local() | ||||
@@ -23,42 +23,40 @@ def setup(): | |||||
except ImportError: pass | except ImportError: pass | ||||
app_paths = [os.path.dirname(pymodule.__file__) for pymodule in pymodules] | 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""" | """concat / minify js files""" | ||||
# build js files | # build js files | ||||
setup() | setup() | ||||
make_asset_dirs(make_copy=make_copy) | 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""" | """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): | def make_asset_dirs(make_copy=False): | ||||
assets_path = os.path.join(frappe.local.sites_path, "assets") | 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.command('build') | ||||
@click.option('--make-copy', is_flag=True, default=False, help='Copy the files instead of symlinking') | @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('--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" | "Minify + concatenate JS and CSS files, build translations" | ||||
import frappe.build | import frappe.build | ||||
import frappe | import frappe | ||||
frappe.init('') | 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.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" | "Watch and concatenate JS and CSS files as and when they change" | ||||
import frappe.build | import frappe.build | ||||
frappe.init('') | frappe.init('') | ||||
frappe.build.watch(True, beta=beta) | |||||
frappe.build.watch(True) | |||||
@click.command('clear-cache') | @click.command('clear-cache') | ||||
@pass_context | @pass_context | ||||