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
Prev Previous commit
Next Next commit
Only build needed semantic components
  • Loading branch information
lunny committed Jan 20, 2020
commit d195d0de240a3369539d49bda2a645e5ca38fc0c
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ CSS_SOURCES ?= $(shell find web_src/less -type f)

JS_DEST := public/js/index.js
CSS_DEST := public/css/index.css

lunny marked this conversation as resolved.
Show resolved Hide resolved
BINDATA_DEST := modules/public/bindata.go modules/options/bindata.go modules/templates/bindata.go

JS_DEST_DIR := public/js
Expand Down Expand Up @@ -472,15 +473,18 @@ 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:
cd web_src/fomantic && npx gulp 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