2019-01-01 20:42:00 +03:00
|
|
|
# Copyright (c) 2016-2019 Martin Donath <martin.donath@squidfunk.com>
|
2017-11-21 23:32:25 +03:00
|
|
|
|
|
|
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
# of this software and associated documentation files (the "Software"), to
|
|
|
|
# deal in the Software without restriction, including without limitation the
|
|
|
|
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
|
|
# sell copies of the Software, and to permit persons to whom the Software is
|
|
|
|
# furnished to do so, subject to the following conditions:
|
|
|
|
|
|
|
|
# The above copyright notice and this permission notice shall be included in
|
|
|
|
# all copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
|
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
|
|
# IN THE SOFTWARE.
|
|
|
|
|
|
|
|
all: clean lint | build
|
|
|
|
|
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
# Prerequisites
|
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
# Install dependencies
|
|
|
|
node_modules:
|
2018-02-21 23:06:11 +03:00
|
|
|
npm install
|
2017-11-21 23:32:25 +03:00
|
|
|
|
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
# Targets
|
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
# Build theme for distribution with Webpack
|
2017-11-22 20:59:48 +03:00
|
|
|
material: $(shell find src) .babelrc webpack.config.js
|
2018-12-28 16:44:41 +03:00
|
|
|
$(shell npm bin)/webpack --mode production
|
2017-11-21 23:32:25 +03:00
|
|
|
|
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
# Rules
|
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
# Build distribution files
|
|
|
|
build: node_modules material
|
|
|
|
|
|
|
|
# Clean distribution files
|
|
|
|
clean:
|
|
|
|
rm -rf material
|
|
|
|
|
|
|
|
# Lint source files
|
|
|
|
lint: node_modules
|
2018-02-21 23:06:11 +03:00
|
|
|
$(shell npm bin)/eslint --max-warnings 0 .
|
|
|
|
$(shell npm bin)/stylelint `find src/assets -name *.scss`
|
2017-11-21 23:32:25 +03:00
|
|
|
|
|
|
|
# Rebuild theme on changes with Webpack
|
|
|
|
watch-webpack: node_modules clean
|
2018-02-21 23:06:11 +03:00
|
|
|
$(shell npm bin)/webpack --watch
|
2017-11-21 23:32:25 +03:00
|
|
|
|
|
|
|
# Serve documentation with MkDocs
|
|
|
|
watch-mkdocs: clean
|
|
|
|
while [ ! -d "./material" ]; do sleep 1; done
|
|
|
|
mkdocs serve
|
|
|
|
|
|
|
|
# Run Webpack and MkDocs in watch mode
|
|
|
|
watch: node_modules watch-webpack watch-mkdocs
|
|
|
|
|
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
# Special targets
|
|
|
|
.PHONY: .FORCE build clean lint watch watch-mkdocs watch-webpack
|
|
|
|
.FORCE:
|