Browse Source

changing strategy of rjs compilation to rjs conf file within source structure to target temp file.

main
Ilker Cetinkaya 12 years ago
committed by Lakshmi Vyasarajan
parent
commit
498edc7730
1 changed files with 5 additions and 6 deletions
  1. +5
    -6
      hyde/ext/plugins/rjs.py

+ 5
- 6
hyde/ext/plugins/rjs.py View File

@@ -27,11 +27,11 @@ class RequireJSPlugin(CLTransformer):


def begin_site(self): def begin_site(self):
""" """
Find all the less css files and set their relative deploy path.
Find the rjs conf file and set their relative deploy path.
""" """
for resource in self.site.content.walk_resources(): for resource in self.site.content.walk_resources():
if resource.source_file.name_without_extension == "main" and resource.source_file.kind == "js":
new_name = resource.source_file.name_without_extension + "-bin.js"
if resource.source_file.name_without_extension == "rjs" and resource.source_file.kind == "conf":
new_name = "app.js"
target_folder = File(resource.relative_deploy_path).parent target_folder = File(resource.relative_deploy_path).parent
resource.relative_deploy_path = target_folder.child(new_name) resource.relative_deploy_path = target_folder.child(new_name)


@@ -48,15 +48,14 @@ class RequireJSPlugin(CLTransformer):
Read the generated file and return the text as output. Read the generated file and return the text as output.
Set the target path to have a css extension. Set the target path to have a css extension.
""" """
if not resource.source_file.kind == 'js' and not resource.source_file.name_without_extension == "main":
if not resource.source_file.kind == 'conf' and not resource.source_file.name_without_extension == "rjs":
return return


rjs = self.app rjs = self.app
source = File.make_temp(text)
target = File.make_temp('') target = File.make_temp('')
args = [unicode(rjs)] args = [unicode(rjs)]
args.extend(['-o']) args.extend(['-o'])
args.extend([unicode(source)])
args.extend([unicode(resource)])
args.extend([("out=" + target.fully_expanded_path)]) args.extend([("out=" + target.fully_expanded_path)])
try: try:
self.call_app(args) self.call_app(args)


Loading…
Cancel
Save