diff options
| author | 2014-03-09 03:14:40 +0100 | |
|---|---|---|
| committer | 2014-03-09 03:14:40 +0100 | |
| commit | fa50632a9d87c3989566fed3e49c160a132e0d14 (patch) | |
| tree | 81f58cc0dcfbb34710856b59c034bc47c53d91dc /nikola/plugins/task/build_sass.py | |
| parent | 2828399ba5cbb14502b023d4de1ba02f13dd5055 (diff) | |
Imported Upstream version 6.4.0upstream/6.4.0
Diffstat (limited to 'nikola/plugins/task/build_sass.py')
| -rw-r--r-- | nikola/plugins/task/build_sass.py | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/nikola/plugins/task/build_sass.py b/nikola/plugins/task/build_sass.py index 7575505..becc843 100644 --- a/nikola/plugins/task/build_sass.py +++ b/nikola/plugins/task/build_sass.py @@ -47,26 +47,41 @@ class BuildSass(Task): """Generate CSS out of Sass sources.""" self.logger = utils.get_logger('build_sass', self.site.loghandlers) self.compiler_name = self.site.config['SASS_COMPILER'] + self.compiler_options = self.site.config['SASS_OPTIONS'] kw = { 'cache_folder': self.site.config['CACHE_FOLDER'], 'themes': self.site.THEMES, } + tasks = {} # Find where in the theme chain we define the Sass targets # There can be many *.sass/*.scss in the folder, but we only # will build the ones listed in sass/targets - targets_path = utils.get_asset_path(os.path.join(self.sources_folder, "targets"), self.site.THEMES) + if os.path.isfile(os.path.join(self.sources_folder, "targets")): + targets_path = os.path.join(self.sources_folder, "targets") + else: + targets_path = utils.get_asset_path(os.path.join(self.sources_folder, "targets"), self.site.THEMES) try: with codecs.open(targets_path, "rb", "utf-8") as inf: targets = [x.strip() for x in inf.readlines()] except Exception: targets = [] + for task in utils.copy_tree(self.sources_folder, os.path.join(kw['cache_folder'], self.sources_folder)): + if task['name'] in tasks: + continue + task['basename'] = 'prepare_sass_sources' + tasks[task['name']] = task + yield task + for theme_name in kw['themes']: src = os.path.join(utils.get_theme_path(theme_name), self.sources_folder) for task in utils.copy_tree(src, os.path.join(kw['cache_folder'], self.sources_folder)): + if task['name'] in tasks: + continue task['basename'] = 'prepare_sass_sources' + tasks[task['name']] = task yield task # Build targets and write CSS files @@ -83,7 +98,7 @@ class BuildSass(Task): run_in_shell = sys.platform == 'win32' src = os.path.join(kw['cache_folder'], self.sources_folder, target) try: - compiled = subprocess.check_output([self.compiler_name, src], shell=run_in_shell) + compiled = subprocess.check_output([self.compiler_name] + self.compiler_options + [src], shell=run_in_shell) except OSError: utils.req_missing([self.compiler_name], 'build Sass files (and use this theme)', |
