mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Remove redundant LESS_COMPILER setting
This commit is contained in:
parent
2b93d6d855
commit
f558389006
5 changed files with 11 additions and 8 deletions
|
|
@ -82,9 +82,9 @@ Setting name (default value) What does it do?
|
|||
generated HTML, using the `Typogrify
|
||||
<http://static.mintchaos.com/projects/typogrify/>`_
|
||||
library
|
||||
`LESS_GENERATOR` (``FALSE``) Set to True if you want to enable compiling less
|
||||
files. Requires installation of `less css`_.
|
||||
`LESS_COMPILER` (``'/usr/bin/lessc'``) The path to less css compiler (`lessc`)
|
||||
`LESS_GENERATOR` (``FALSE``) Set to True or complete path to `lessc` (if not
|
||||
found in system PATH) to enable compiling less
|
||||
css files. Requires installation of `less css`_.
|
||||
================================================ =====================================================
|
||||
|
||||
.. [#] Default is the system locale.
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ class Pelican(object):
|
|||
generators = [ArticlesGenerator, PagesGenerator, StaticGenerator]
|
||||
if self.settings['PDF_GENERATOR']:
|
||||
generators.append(PdfGenerator)
|
||||
if self.settings['LESS_GENERATOR']:
|
||||
if self.settings['LESS_GENERATOR']: # can be True or PATH to lessc
|
||||
generators.append(LessCSSGenerator)
|
||||
return generators
|
||||
|
||||
|
|
|
|||
|
|
@ -418,7 +418,7 @@ class PdfGenerator(Generator):
|
|||
|
||||
|
||||
class LessCSSGenerator(Generator):
|
||||
"""Compile less css files. This assumes we have `lessc` in our PATH."""
|
||||
"""Compile less css files."""
|
||||
|
||||
def _compile(self, less_file, source_dir, dest_dir):
|
||||
base = os.path.relpath(less_file, source_dir)
|
||||
|
|
@ -433,13 +433,18 @@ class LessCSSGenerator(Generator):
|
|||
logger.error("Couldn't create the pdf output folder in " +
|
||||
target_dir)
|
||||
|
||||
cmd = ' '.join([self.settings['LESS_COMPILER'], less_file, target])
|
||||
cmd = ' '.join([self._lessc, less_file, target])
|
||||
subprocess.call(cmd, shell=True)
|
||||
logger.info(u' [ok] compiled %s' % base)
|
||||
|
||||
def generate_output(self, writer=None):
|
||||
logger.info(u' Compiling less css')
|
||||
|
||||
# store out compiler here, so it won't be evaulted on each run of
|
||||
# _compile
|
||||
lg = self.settings['LESS_GENERATOR']
|
||||
self._lessc = lg if isinstance(lg, basestring) else 'lessc'
|
||||
|
||||
# walk static paths
|
||||
for static_path in self.settings['STATIC_PATHS']:
|
||||
for f in self.get_files(
|
||||
|
|
|
|||
|
|
@ -68,7 +68,6 @@ _DEFAULT_CONFIG = {'PATH': '.',
|
|||
'ARTICLE_PERMALINK_STRUCTURE': '',
|
||||
'TYPOGRIFY': False,
|
||||
'LESS_GENERATOR': False,
|
||||
'LESS_COMPILER': '/usr/bin/lessc',
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -68,7 +68,6 @@ class TestLessCSSGenerator(unittest.TestCase):
|
|||
settings = _DEFAULT_CONFIG.copy()
|
||||
settings['STATIC_PATHS'] = ['static']
|
||||
settings['LESS_GENERATOR'] = True
|
||||
settings['LESS_COMPILER'] = 'lessc'
|
||||
|
||||
# we'll nest here for py < 2.7 compat
|
||||
with temporary_folder() as temp_content:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue