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

Use npm to manage fomantic and only build needed components #9561

Merged
merged 14 commits into from
Jan 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ coverage.all
/yarn.lock
/public/js
/public/css
/public/fomantic

# Snapcraft
snap/.snapcraft/
Expand Down
14 changes: 11 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ BINDATA_DEST := modules/public/bindata.go modules/options/bindata.go modules/tem

JS_DEST_DIR := public/js
CSS_DEST_DIR := public/css
FOMANTIC_DEST_DIR := public/fomantic

TAGS ?=

Expand Down Expand Up @@ -138,7 +139,7 @@ node-check:

.PHONY: clean-all
clean-all: clean
rm -rf $(JS_DEST_DIR) $(CSS_DEST_DIR)
rm -rf $(JS_DEST_DIR) $(CSS_DEST_DIR) $(FOMANTIC_DEST_DIR)

.PHONY: clean
clean:
Expand Down Expand Up @@ -474,14 +475,21 @@ npm-update: node-check node_modules
npm install --package-lock

.PHONY: js
js: node-check $(JS_DEST)
js: node-check fomantic $(JS_DEST)

$(JS_DEST): node_modules $(JS_SOURCES)
npx eslint web_src/js webpack.config.js
npx webpack

.PHONY: fomantic
fomantic: node-check $(FOMANTIC_DEST_DIR)

$(FOMANTIC_DEST_DIR): node_modules semantic.json web_src/fomantic/theme.config.less
cp web_src/fomantic/theme.config.less node_modules/fomantic-ui/src/theme.config
npx gulp -f node_modules/fomantic-ui/gulpfile.js build

Copy link
Member

Choose a reason for hiding this comment

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

Maybe it is possible to have this as a non-phony target that depends on package-lock.json, so it would only run if dependencies change.

Copy link
Member

@silverwind silverwind Jan 4, 2020

Choose a reason for hiding this comment

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

Also, I'd suggest the target to be adjusted to provide one or more output files, like public/fomantic/semantic.min.js and public/fomantic/semantic.min.css. We can still have a phony fomantic target that depends on that file to trigger it on-demand.

.PHONY: css
css: node-check $(CSS_DEST)
css: node-check fomantic $(CSS_DEST)

$(CSS_DEST): node_modules $(CSS_SOURCES)
npx stylelint web_src/less
Expand Down
Loading