Skip to content
This repository has been archived by the owner on May 7, 2021. It is now read-only.

Commit

Permalink
feat(Makefile): use Makefile for running tasks, retiring gulp
Browse files Browse the repository at this point in the history
  • Loading branch information
debloper committed May 21, 2018
1 parent cf9f768 commit 596d385
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
55 changes: 55 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# First off, let's fetch in the executables installed with npm
PATH := node_modules/.bin:$(PATH)

.PHONY: build

.PHONY: watch

build: processjs processcss processhtml processfiles

watch: watchjs watchcss watchhtml watchfiles

processjs:
# Compiling TypeScript to JavaScript...
# (according to the configs set in default tsconfig.json)
@tsc

# This hack is required to make the templates/styles consumable with require()
@for jsfile in `find dist/app -name '*.js'`; do \
sed -i -r -e "s/templateUrl:\s+('.+')/template: require(\1)/g" $$jsfile; \
sed -i -r -e "s/styleUrls:\s+\[('.+')\]/styles: \[require(\1).toString()\]/g" $$jsfile; \
done

watchjs:
@chokidar --verbose 'src/**/*.ts' -c 'make processjs'

processcss:
# Compiling LESS to CSS
# @TODO: lesshint report & failOnError
@for lessfile in `find src -name '*.less'`; do \
csspath="$${lessfile/src/dist}"; \
cssfile="$${csspath/\.less/\.css}"; \
lessc --source-map --autoprefix="last 2 versions" $$lessfile $$cssfile; \
done

watchcss:
@chokidar --verbose 'src/**/*.less' -c 'make processcss'

processhtml:
# Copying HTML over to respective paths in dist directory
@for htmlfile in `find src -name '*.html'`; do \
htmlname=$$(basename $$htmlfile); \
htmlpath="$${htmlfile/src/dist}"; \
htmldest="$${htmlpath/$$htmlname/}"; \
cp $$htmlfile $$htmldest; \
done

watchhtml:
@chokidar --verbose 'src/**/*.html' -c 'make processhtml'

processfiles:
# Copying LICENSE README.adoc & package.json over to dist/
@cp LICENSE README.adoc package.json dist/

watchfiles:
@chokidar --verbose 'LICENSE' 'README.adoc' 'package.json' -c 'make processfiles'
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
"@ngrx/effects": "^4.1.1",
"@ngrx/store": "^4.1.1",
"@ngrx/store-devtools": "^4.1.1",
"chokidar-cli": "^1.2.0",
"core-js": "^2.5.1",
"less-plugin-autoprefix": "^1.5.1",
"lodash": "^4.17.4",
Expand Down

0 comments on commit 596d385

Please sign in to comment.