Skip to content
13 changes: 7 additions & 6 deletions compressor_toolkit/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ class CompressorToolkitConfig(AppConfig):
NODE_SASS_BIN = getattr(
settings,
'COMPRESS_NODE_SASS_BIN',
'node_modules/.bin/node-sass' if LOCAL_NPM_INSTALL else 'node-sass'
os.path.join('node_modules', '.bin', 'node-sass') if LOCAL_NPM_INSTALL else 'node-sass'
)

# postcss executable
POSTCSS_BIN = getattr(
settings,
'COMPRESS_POSTCSS_BIN',
'node_modules/.bin/postcss' if LOCAL_NPM_INSTALL else 'postcss'
os.path.join('node_modules', '.bin', 'postcss') if LOCAL_NPM_INSTALL else 'postcss'
)

# Browser versions config for Autoprefixer
Expand All @@ -36,17 +36,18 @@ class CompressorToolkitConfig(AppConfig):
# Custom SCSS transpiler command
SCSS_COMPILER_CMD = getattr(settings, 'COMPRESS_SCSS_COMPILER_CMD', (
'{node_sass_bin} --output-style expanded {paths} "{infile}" > "{outfile}" && '
'{postcss_bin} --use "{node_modules}/autoprefixer" '
'--autoprefixer.browsers "{autoprefixer_browsers}" -r "{outfile}"'
'{postcss_bin} --use "%(autoprefixer)s" '
'--autoprefixer.browsers "{autoprefixer_browsers}" -r "{outfile}"' %
{'autoprefixer': os.path.join(NODE_MODULES, 'autoprefixer')}
))

# browserify executable
BROWSERIFY_BIN = getattr(
settings,
'COMPRESS_BROWSERIFY_BIN',
'node_modules/.bin/browserify' if LOCAL_NPM_INSTALL else 'browserify'
os.path.join('node_modules', '.bin', 'browserify') if LOCAL_NPM_INSTALL else 'browserify'
)

# Custom ES6 transpiler command
ES6_COMPILER_CMD = getattr(settings, 'COMPRESS_ES6_COMPILER_CMD', (
'export NODE_PATH="{paths}" && '
Expand Down