[REF] ir_qweb: less webasset: compress output instead of minifying it

* Remove dependency on less-plugin-clean-css which distribution
  packages are broken on debian stretch and derivated.
* Updated documentation.
* Lessc provides a `--compress` argument that could solve this issue.
  According to the documentation at http://lesscss.org/usage/: "[...]
  Compress using less built-in compression. This does an okay job but
  does not utilise all the tricks of dedicated css compression[...]"
  However, using this argument works on lessc 2.5.3 but not on 1.4.2
  (`--compress` arg is present but seems to be break some rules
  i haven't been able to put my finger on).
* Finally, use the minification of the StylesheetAsset that takes care
  of removing the spaces, the comments and the sourcemap with regexes.

fixes issue #9113
This commit is contained in:
Simon Lejeune
2016-06-10 17:22:03 +02:00
parent b466a9eea0
commit 123e51f4d5
7 changed files with 7 additions and 15 deletions
-1
View File
@@ -15,7 +15,6 @@ Depends:
${misc:Depends},
adduser,
node-less,
node-clean-css,
postgresql-client,
python,
python-dateutil,
+6 -6
View File
@@ -462,25 +462,25 @@ Source installation requires manually installing dependencies:
$ apt-get install -y npm
$ sudo ln -s /usr/bin/nodejs /usr/bin/node
Once npm is installed, use it to install less and less-plugin-clean-css:
Once npm is installed, use it to install less:
.. code-block:: console
$ sudo npm install -g less less-plugin-clean-css
$ sudo npm install -g less
- on OS X, install nodejs via your preferred package manager (homebrew_,
macports_) then install less and less-plugin-clean-css:
macports_) then install less:
.. code-block:: console
$ sudo npm install -g less less-plugin-clean-css
$ sudo npm install -g less
- on Windows, `install nodejs <http://nodejs.org/download/>`_, reboot (to
update the :envvar:`PATH`) and install less and less-plugin-clean-css:
update the :envvar:`PATH`) and install less:
.. code-block:: ps1
C:\> npm install -g less less-plugin-clean-css
C:\> npm install -g less
Running Odoo
------------
+1 -4
View File
@@ -1636,9 +1636,6 @@ class PreprocessedCSS(StylesheetAsset):
self.html_url_format = '%%s/%s/%%s.css' % self.bundle.xmlid
self.html_url_args = tuple(self.url.rsplit('/', 1))
def minify(self):
return self.with_header()
def get_source(self):
content = self.inline or self._fetch_content()
return "/*! %s */\n%s" % (self.id, content)
@@ -1688,7 +1685,7 @@ class LessStylesheetAsset(PreprocessedCSS):
except IOError:
lessc = 'lessc'
lesspath = get_resource_path('web', 'static', 'lib', 'bootstrap', 'less')
return [lessc, '-', '--clean-css', '--no-js', '--no-color', '--include-path=%s' % lesspath]
return [lessc, '-', '--no-js', '--no-color', '--include-path=%s' % lesspath]
def rjsmin(script):
""" Minify js with a clever regex.
-1
View File
@@ -6,7 +6,6 @@ requires =
babel
libxslt-python
nodejs-less
nodejs-clean-css
pychart
pyparsing
python-dateutil
-1
View File
@@ -10,7 +10,6 @@ RUN yum install -d 0 -e 0 epel-release -y && \
babel \
libxslt-python \
nodejs-less \
nodejs-clean-css \
pychart \
pyparsing \
python-dateutil \
-1
View File
@@ -18,7 +18,6 @@ RUN apt-get update -qq && \
apt-get install \
adduser \
node-less \
node-clean-css \
postgresql \
postgresql-client \
python \
-1
View File
@@ -21,7 +21,6 @@ RUN apt-get update -qq && \
postgresql-client \
adduser \
node-less \
node-clean-css \
libxml2-dev \
libxslt1-dev \
libldap2-dev \