Commit 6bc0922b by Timothée Peignier

add a way to compress a specified group with synccompress. close #8

parent 313621c2
from optparse import make_option from optparse import make_option
from django.core.management.base import NoArgsCommand from django.core.management.base import BaseCommand
class Command(NoArgsCommand): class Command(BaseCommand):
option_list = NoArgsCommand.option_list + ( option_list = BaseCommand.option_list + (
make_option('--force', make_option('--force',
action='store_true', action='store_true',
default=False, default=False,
...@@ -12,9 +12,9 @@ class Command(NoArgsCommand): ...@@ -12,9 +12,9 @@ class Command(NoArgsCommand):
), ),
) )
help = 'Updates and compresses CSS and JS on-demand, without restarting Django' help = 'Updates and compresses CSS and JS on-demand, without restarting Django'
args = '' args = '<group>'
def handle_noargs(self, **options): def handle(self, group=None, **options):
from pipeline.packager import Packager from pipeline.packager import Packager
packager = Packager( packager = Packager(
sync=True, sync=True,
...@@ -23,6 +23,8 @@ class Command(NoArgsCommand): ...@@ -23,6 +23,8 @@ class Command(NoArgsCommand):
) )
for package_name in packager.packages['css']: for package_name in packager.packages['css']:
if group and package_name != group:
continue
package = packager.package_for('css', package_name) package = packager.package_for('css', package_name)
if packager.verbose or packager.force: if packager.verbose or packager.force:
print print
...@@ -32,6 +34,8 @@ class Command(NoArgsCommand): ...@@ -32,6 +34,8 @@ class Command(NoArgsCommand):
packager.pack_stylesheets(package) packager.pack_stylesheets(package)
for package_name in packager.packages['js']: for package_name in packager.packages['js']:
if group and package_name != group:
continue
package = packager.package_for('js', package_name) package = packager.package_for('js', package_name)
if packager.verbose or packager.force: if packager.verbose or packager.force:
print print
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment