-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
feat: add convert less css file step. #1861
Conversation
I'd go the route of changing the So I'd suggest changing the |
Makefile
Outdated
docker run --rm -v $(PWD):/app appleboy/node-less $< $@; \ | ||
else \ | ||
lessc $< $@; \ | ||
fi |
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 might be better to just depend on node
and npm
and then install node-less
as a local dependency (with a package.json
) than to depend on docker.
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.
Not all golang developer have node environment so docker is better for everyone.
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.
Okay, this is good for now. If we do a full node build for assets, I think adding it as a hard dependency might be best, it's usually just a apt-get
away, no environment setup necessary.
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 don't know what you mean. Can you explain the detail steps?
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.
Modern frontend development includes a series of preprocessing to assets, like concatenating, automatically adding vendor prefixes, minifying css and js, precompiling gzip/brotli artifacts and more. The tools used for that all come from the Node.js/npm ecosystem, so I see Node.js as a requirement for any serious web development.
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 think we can improve the workflow in dockerfile https://github.com/appleboy/node-less and make new PR to implement or maybe we can try the webpack
solution.
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.
In place of docker we could try https://github.com/kib357/less-go. It has a cli interface ready under : github.com/kib357/less-go/lessc. It is a little hacky implementation but it should work.
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.
@sapk Good. I will try it out.
But that's not go getable? |
@lunny No. sad. |
But I think go getable is a needed feature of Gitea. |
Makefile
Outdated
@@ -35,12 +35,12 @@ else | |||
endif | |||
|
|||
.PHONY: all | |||
all: build | |||
all: clean assets generate build |
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.
make
shouldn't run clean
🙁
Makefile
Outdated
@@ -186,14 +186,18 @@ stylesheets: public/css/index.css | |||
|
|||
.IGNORE: public/css/index.css | |||
public/css/index.css: $(STYLESHEETS) | |||
lessc $< $@ | |||
@hash lessc > /dev/null 2>&1; if [ $$? -ne 0 ]; then \ | |||
docker run --rm -v $(PWD):/app appleboy/node-less $< $@; \ |
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.
You never check that people have docker installed...
Actually, don't do this, just add a |
Then check if both OR neither contain something |
@appleboy FWIW, you need to check between base and compare branches otherwise this would happen
|
Let's move to v1.3 |
Check output CSS file from less converter. Just like |
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.
Few little changes to keep historical commands working.
Makefile
Outdated
fi; | ||
|
||
.PHONY: less | ||
less: |
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 would be better to update public/css/index.css
and stylesheets
target to have compat with old syntax and be included in assets
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.
Maybe use stylesheets-check
in place of less-check
to be consistent but that would be a personal point and not mandatory. ^^
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.
var STYLESHEETS
if not needed anymore should be remove.
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.
updated.
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.
Solution is a little brutal but I like the cleanning. 😄
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 is this a .PHONY
? Why not public/css/index.css:
?
LGTM |
@bkcsoft Waiting for your response. |
@appleboy I don't like that it runs even when things aren't changed. See my comment in the review :) |
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
@bkcsoft Done. Please review again. |
LGTM |
Add convert less css file in drone CI/CD step.
ref #1860 (comment)