зеркало из https://github.com/mozilla/bedrock.git
Switch to UglifyJS and CleanCSS compressors
This commit is contained in:
Родитель
4b867293e4
Коммит
01088d4549
|
@ -0,0 +1,10 @@
|
|||
from __future__ import absolute_import
|
||||
|
||||
from pipeline.conf import settings
|
||||
from pipeline.compressors import SubProcessCompressor
|
||||
|
||||
|
||||
class CleanCSSCompressor(SubProcessCompressor):
|
||||
def compress_css(self, css):
|
||||
command = (settings.CLEANCSS_BINARY, settings.CLEANCSS_ARGUMENTS)
|
||||
return self.execute_command(command, css)
|
|
@ -273,7 +273,7 @@ MEDIA_ROOT = config('MEDIA_ROOT', default=path('media'))
|
|||
STATIC_URL = config('STATIC_URL', default='/media/')
|
||||
STATIC_ROOT = config('STATIC_ROOT', default=path('static'))
|
||||
STATICFILES_STORAGE = ('pipeline.storage.NonPackagingPipelineStorage' if DEBUG else
|
||||
'bedrock.base.storage.ManifestPipelineStorage')
|
||||
'bedrock.base.pipeline_storage.ManifestPipelineStorage')
|
||||
STATICFILES_FINDERS = (
|
||||
'django.contrib.staticfiles.finders.FileSystemFinder',
|
||||
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
|
||||
|
@ -299,10 +299,14 @@ PIPELINE = {
|
|||
'LESS_BINARY': config('PIPELINE_LESS_BINARY',
|
||||
default=path('node_modules', 'less', 'bin', 'lessc')),
|
||||
'LESS_ARGUMENTS': config('PIPELINE_LESS_ARGUMENTS', default='-s'),
|
||||
'JS_COMPRESSOR': 'pipeline.compressors.yuglify.YuglifyCompressor',
|
||||
'CSS_COMPRESSOR': 'pipeline.compressors.yuglify.YuglifyCompressor',
|
||||
'YUGLIFY_BINARY': config('PIPELINE_YUGLIFY_BINARY',
|
||||
default=path('node_modules', '.bin', 'yuglify')),
|
||||
'JS_COMPRESSOR': 'pipeline.compressors.uglifyjs.UglifyJSCompressor',
|
||||
'UGLIFYJS_BINARY': config('PIPELINE_UGLIFYJS_BINARY',
|
||||
default=path('node_modules', '.bin', 'uglifyjs')),
|
||||
'UGLIFYJS_ARGUMENTS': config('PIPELINE_UGLIFYJS_ARGUMENTS', default='--support-ie8'),
|
||||
'CSS_COMPRESSOR': 'bedrock.base.pipeline_compressors.CleanCSSCompressor',
|
||||
'CLEANCSS_BINARY': config('PIPELINE_CLEANCSS_BINARY',
|
||||
default=path('node_modules', '.bin', 'cleancss')),
|
||||
'CLEANCSS_ARGUMENTS': config('PIPELINE_CLEANCSS_ARGUMENTS', default='--compatibility ie7'),
|
||||
'PIPELINE_ENABLED': config('PIPELINE_ENABLED', not DEBUG, cast=bool),
|
||||
'PIPELINE_COLLECTOR_ENABLED': config('PIPELINE_COLLECTOR_ENABLED', not DEBUG, cast=bool),
|
||||
}
|
||||
|
|
|
@ -3,7 +3,8 @@ FROM mozorg/bedrock_base:${GIT_COMMIT}
|
|||
ENV PATH=/node_modules/.bin:$PATH
|
||||
ENV PIPELINE_LESS_BINARY=lessc
|
||||
ENV PIPELINE_SASS_BINARY=node-sass
|
||||
ENV PIPELINE_YUGLIFY_BINARY=yuglify
|
||||
ENV PIPELINE_UGLIFYJS_BINARY=uglifyjs
|
||||
ENV PIPELINE_CLEANCSS_BINARY=cleancss
|
||||
|
||||
RUN apt-get install -y --no-install-recommends nodejs-legacy npm
|
||||
|
||||
|
|
|
@ -3,7 +3,8 @@ FROM bedrock_base
|
|||
ENV PATH=/node_modules/.bin:$PATH
|
||||
ENV PIPELINE_LESS_BINARY=lessc
|
||||
ENV PIPELINE_SASS_BINARY=node-sass
|
||||
ENV PIPELINE_YUGLIFY_BINARY=yuglify
|
||||
ENV PIPELINE_UGLIFYJS_BINARY=uglifyjs
|
||||
ENV PIPELINE_CLEANCSS_BINARY=cleancss
|
||||
|
||||
COPY ./node_modules /
|
||||
COPY package.json /
|
||||
|
|
1639
lockdown.json
1639
lockdown.json
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -7,10 +7,11 @@
|
|||
"preinstall": "lockdown"
|
||||
},
|
||||
"dependencies": {
|
||||
"clean-css-cli": "4.0.5",
|
||||
"less": "2.7.1",
|
||||
"lockdown": "https://github.com/mozilla/npm-lockdown/archive/v0.0.8.tar.gz",
|
||||
"node-sass": "4.5.0",
|
||||
"yuglify": "0.1.4"
|
||||
"uglify-js": "2.7.5"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
|
Загрузка…
Ссылка в новой задаче