Skip to content

Commit

Permalink
CLI. front-end-build
Browse files Browse the repository at this point in the history
  • Loading branch information
smotornyuk committed Nov 18, 2019
1 parent f2cea08 commit b52ee90
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ckan/cli/cli.py
Expand Up @@ -6,6 +6,7 @@
from ckan.cli import config_tool
from ckan.cli import (
datapusher,
front_end_build,
click_config_option, db, load_config, search_index, server,
asset,
datastore,
Expand Down Expand Up @@ -41,6 +42,7 @@ def ckan(ctx, config, *args, **kwargs):


ckan.add_command(config_tool.config_tool)
ckan.add_command(front_end_build.front_end_build)
ckan.add_command(server.run)
ckan.add_command(seed.seed)
ckan.add_command(db.db)
Expand Down
34 changes: 34 additions & 0 deletions ckan/cli/front_end_build.py
@@ -0,0 +1,34 @@
# encoding: utf-8

import os

import click

from ckan.cli import minify, less, translation
import ckan.plugins.toolkit as toolkit


@click.group(
name=u"front-end-build",
short_help=u"Creates and minifies css and JavaScript files.",
invoke_without_command=True,
)
@click.pass_context
def front_end_build(ctx):
if ctx.invoked_subcommand is None:
ctx.invoke(build)


@front_end_build.command(short_help=u"Compile css and js.",)
@click.pass_context
def build(ctx):
ctx.invoke(less.less)
ctx.invoke(translation.js)

# minification
public = toolkit.config.get(u"ckan.base_public_folder")
root = os.path.join(os.path.dirname(__file__), u"..", public, u"base")
root = os.path.abspath(root)
ckanext = os.path.join(os.path.dirname(__file__), u"..", u"..", u"ckanext")
ckanext = os.path.abspath(ckanext)
cmd = ctx.invoke(minify.minify, path=(root, ckanext))

0 comments on commit b52ee90

Please sign in to comment.