Skip to content
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

Merged
merged 2 commits into from
Jul 12, 2017
Merged

Conversation

appleboy
Copy link
Member

@appleboy appleboy commented Jun 3, 2017

Add convert less css file in drone CI/CD step.

ref #1860 (comment)

@silverwind
Copy link
Member

silverwind commented Jun 3, 2017

I'd go the route of changing the all task in the Makefile to include all necessary steps to complete a full build, including assets. It certainly caught me off guard that the suggested make generate build does not build assets.

So I'd suggest changing the all task to build everything, maybe including bindata as this seems to be the prefered build these days. Basically make make an alias to TAGS="bindata" make assets generate build (and probably other targets) and run just make on drone.

@tboerger tboerger added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jun 3, 2017
@appleboy appleboy added the type/enhancement An improvement of existing functionality label Jun 3, 2017
@appleboy appleboy added this to the 1.2.0 milestone Jun 3, 2017
Makefile Outdated
docker run --rm -v $(PWD):/app appleboy/node-less $< $@; \
else \
lessc $< $@; \
fi
Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member

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.

Copy link
Member Author

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?

Copy link
Member

@silverwind silverwind Jun 3, 2017

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.

Copy link
Member Author

@appleboy appleboy Jun 3, 2017

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.

Copy link
Member

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.

Copy link
Member Author

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.

@lunny
Copy link
Member

lunny commented Jun 3, 2017

But that's not go getable?

@appleboy
Copy link
Member Author

appleboy commented Jun 3, 2017

@lunny No. sad.

@lunny
Copy link
Member

lunny commented Jun 3, 2017

But I think go getable is a needed feature of Gitea.

@appleboy appleboy added the pr/wip This PR is not ready for review label Jun 4, 2017
Makefile Outdated
@@ -35,12 +35,12 @@ else
endif

.PHONY: all
all: build
all: clean assets generate build
Copy link
Member

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 $< $@; \
Copy link
Member

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...

@bkcsoft
Copy link
Member

bkcsoft commented Jun 11, 2017

Actually, don't do this, just add a make verify-css step 🙂

@bkcsoft
Copy link
Member

bkcsoft commented Jun 11, 2017

$ git log --oneline --numstat $oldHead..$newHead | awk '/[0-9]+\s+[0-9]+/ { print $3 }' | grep ".less"
$ git log --oneline --numstat $oldHead..$newHead | awk '/[0-9]+\s+[0-9]+/ { print $3 }' | grep ".css"

Then check if both OR neither contain something

@lunny
Copy link
Member

lunny commented Jun 14, 2017

@appleboy agree with @bkcsoft add a verify on makefile is better.

@appleboy
Copy link
Member Author

@lunny @bkcsoft I will update this PR.

@bkcsoft
Copy link
Member

bkcsoft commented Jun 14, 2017

@appleboy FWIW, you need to check between base and compare branches otherwise this would happen

  1. push less-file w/o css-file => build fails
  2. push new commit w/o css/less-file => build passes

@lunny
Copy link
Member

lunny commented Jun 22, 2017

Let's move to v1.3

@appleboy
Copy link
Member Author

Check output CSS file from less converter. Just like make fmt-check command.

@appleboy appleboy removed the pr/wip This PR is not ready for review label Jul 11, 2017
Copy link
Member

@sapk sapk left a 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:
Copy link
Member

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

Copy link
Member

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. ^^

Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated.

Copy link
Member

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. 😄

Copy link
Member

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: ?

@sapk
Copy link
Member

sapk commented Jul 11, 2017

LGTM

@tboerger tboerger added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Jul 11, 2017
@appleboy
Copy link
Member Author

@bkcsoft Waiting for your response.

@appleboy appleboy added this to the 1.2.0 milestone Jul 11, 2017
@appleboy appleboy removed this from the 1.3.0 milestone Jul 11, 2017
@bkcsoft
Copy link
Member

bkcsoft commented Jul 12, 2017

@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 <[email protected]>
Signed-off-by: Bo-Yi Wu <[email protected]>
@appleboy
Copy link
Member Author

@bkcsoft Done. Please review again.

@bkcsoft
Copy link
Member

bkcsoft commented Jul 12, 2017

LGTM

@tboerger tboerger added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Jul 12, 2017
@bkcsoft bkcsoft merged commit 2b05b10 into go-gitea:master Jul 12, 2017
@appleboy appleboy deleted the less branch July 12, 2017 02:29
@go-gitea go-gitea locked and limited conversation to collaborators Nov 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/enhancement An improvement of existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants