Skip to content

Commit

Permalink
[REF] ir_qweb: less webasset: compress output instead of minifying it
Browse files Browse the repository at this point in the history
* 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 odoo#9113
  • Loading branch information
sle-odoo committed Jun 10, 2016
1 parent b466a9e commit 123e51f
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 15 deletions.
1 change: 0 additions & 1 deletion debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ Depends:
${misc:Depends},
adduser,
node-less,
node-clean-css,
postgresql-client,
python,
python-dateutil,
Expand Down
12 changes: 6 additions & 6 deletions doc/setup/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
------------
Expand Down
5 changes: 1 addition & 4 deletions openerp/addons/base/ir/ir_qweb.py
Original file line number Diff line number Diff line change
Expand Up @@ -1636,9 +1636,6 @@ def __init__(self, *args, **kw):
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)
Expand Down Expand Up @@ -1688,7 +1685,7 @@ def get_command(self):
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.
Expand Down
1 change: 0 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ requires =
babel
libxslt-python
nodejs-less
nodejs-clean-css
pychart
pyparsing
python-dateutil
Expand Down
1 change: 0 additions & 1 deletion setup/package.dfcentos
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
1 change: 0 additions & 1 deletion setup/package.dfdebian
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ RUN apt-get update -qq && \
apt-get install \
adduser \
node-less \
node-clean-css \
postgresql \
postgresql-client \
python \
Expand Down
1 change: 0 additions & 1 deletion setup/package.dfsrc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ RUN apt-get update -qq && \
postgresql-client \
adduser \
node-less \
node-clean-css \
libxml2-dev \
libxslt1-dev \
libldap2-dev \
Expand Down

0 comments on commit 123e51f

Please sign in to comment.