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

Move front end source files to web_src and generate index.js minify version #8440

Closed
wants to merge 2 commits into from

Conversation

lunny
Copy link
Member

@lunny lunny commented Oct 9, 2019

Fix #8430 and this will also reduce gitea package size since we moved frontend source files from public directory.

@lunny lunny added the topic/build PR changes how Gitea is built, i.e. regarding Docker or the Makefile label Oct 9, 2019
@lunny lunny added this to the 1.11.0 milestone Oct 9, 2019
@lunny lunny changed the title move front end source files to web_src and generate index.js minify version Move front end source files to web_src and generate index.js minify version Oct 9, 2019
@guillep2k
Copy link
Member

guillep2k commented Oct 9, 2019

Was npm already a requirement for building from source?
EDIT: Sorry, I didn't see that it was only for building js during development.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Oct 9, 2019
@guillep2k
Copy link
Member

Shouldn't we lock to a specific version of the minifier? Otherwise CI build might differ from the committed version.

.PHONY: webpack
webpack: npm
npm install webpack -g

Copy link
Member

@silverwind silverwind Oct 9, 2019

Choose a reason for hiding this comment

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

This is unnecessary, just run npm install --save-dev webpack which will add it as a proper dependency. To run it, use npx webpack <args> afterwards.

@silverwind
Copy link
Member

This doesn't really solve #8430. All that webpack config does is copy source to destination. If you want to minify, you would at least want to add a minify plugin, for which I recommend terser:

https://github.com/webpack-contrib/terser-webpack-plugin

Copy link
Member

@gary-kim gary-kim left a comment

Choose a reason for hiding this comment

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

We should add a package.json and handle dependencies there. We also need to set Webpack to production mode for the final compile, either in the Webpack config or in the command for it.

@lunny
Copy link
Member Author

lunny commented Oct 10, 2019

@gary-kim we already have a package.json file on home dir.

@gary-kim
Copy link
Member

🤦 Forgot about LESS.
What @silverwind said then.

@lunny lunny closed this Oct 20, 2019
@lunny lunny deleted the lunny/web_src branch October 20, 2019 09:38
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. topic/build PR changes how Gitea is built, i.e. regarding Docker or the Makefile
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Minify Javascript
5 participants