New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use standard lessc and minify CSS using Node.js #2337
Conversation
nodejs will be needed anyway to use webpack later so LGTM |
Why not use https://github.com/tdewolff/minify ? I prefer to limit node package for space and dev env. Advantage of https://github.com/tdewolff/minify : we could use it for other format also. |
Makefile
Outdated
lessc -i $< -o $@ | ||
stylesheets: | ||
node_modules/.bin/lessc --no-ie-compat public/less/index.less public/css/index.css | ||
node_modules/.bin/cleancss -o public/css/index.css public/css/index.css |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should output to public/css/index.min.css
(need change also in template for using it) and keep public/css/index.css
for readability.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought the Less source is meant for reading/editing, wouldn't you agree?
(I'm actually not a fan of Less, would rather use SCSS or plain CSS).
For JS, it's slightly worse than
I think I'll go with |
Just to find why you want to use lessc version of node. In this case we could do the same trick and use $(GOPATH)/bin/lessc to select the golang version. |
Yes, exactly. With the node version first in PATH, it was failing to build because that one takes different arguments. I guess I could apply your workaround and keep the dependencies go-only for now. There's no real benefit if using the official But there's still the issue that the go version can break other projects that rely on the standard |
Seems the author of less-go added this to their README:
So I think I'd rather keep |
My principal point of keeping go version is: we don't have "extra" deps. For this PR, if you find enough L-GTM from maintainers it is good for me. I'm not against node deps but rather more prefering go version. 😄 For the PR content itself, it looks good with updated documentation and all. It will just need a new sign for the drone file. Edit: for keeping a go bin out of PATH : |
Urgh, not more javascript :pukes: Add a check that |
@bkcsoft we will need nodejs for compiling js anyway so not much point on keeping around unmaintained golang binary |
This changes the previous nonstandard `lessc` to the official one and enables CSS minification via the clean-css module. To build CSS, Node.js is required along with a `npm install` to get the tools installed locally in node_modules so there is no dependency on binaries in PATH. Benefits include: - Allows one to have a standard lessc in PATH. - Can now use command line switches on lessc. - Minified CSS brings faster page load times and also has the benefit of discouraging contributors from editing CSS directly. To build CSS, Node.js is required along with a `npm install` to get the tools installed locally based on the information in `package.json`. The 'make stylesheet' task was modified to run without condition. This makes it easier to work on the make task itself without having to delete files. Also fixes: go-gitea#2198
afc8c67
to
ea925d8
Compare
Codecov Report
@@ Coverage Diff @@
## master #2337 +/- ##
=======================================
Coverage 26.99% 26.99%
=======================================
Files 85 85
Lines 17097 17097
=======================================
Hits 4615 4615
Misses 11807 11807
Partials 675 675 Continue to review full report at Codecov.
|
Rebased and resolved conflicts We need this as our used less-go does not compile anymore on golang 1.9 and there is error:
To fix its compilation on golang 1.9 go-less needs to be ported to go-duktape.v3 so as go-less is not maintained anymore we should drop it |
LGTM (since less-go is not maintained anymore and fail to build) |
@@ -1,3131 +1 @@ | |||
.emoji { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why deleted public/css/index.css
? I don't think is a good idea to delete this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not deleted it is minimized
This changes the previous nonstandard
lessc
to the official one andenables CSS minification via the clean-css module.
To build CSS, Node.js is required along with a
npm install
to get thetools installed locally in node_modules so there is no dependency on
binaries in PATH. Benefits include:
of discouraging contributors from editing CSS directly.
To build CSS, Node.js is required along with a
npm install
to get thetools installed locally based on the information in
package.json
.