Commit c4c33faf authored by Guillaume Perréal's avatar Guillaume Perréal

Merge branch 'with-makefile'

parents 7f2ec855 9f3e0677
......@@ -2,15 +2,16 @@ stages:
- build
build:
image: node:10
image: node:10-alpine
stage: build
tags: [docker]
interruptible: true
variables:
NPM_CONFIG_CACHE: "$CI_PROJECT_DIR/.npm"
before_script:
- apk update && apk add make bash
script:
- npm install
- npm run build
- make
artifacts:
name: dist
expire_in: 2 years
......
const loadGruntTasks = require("load-grunt-tasks");
module.exports = grunt => {
const BUILD_DIR = "build/";
const DIST_DIR = "dist/";
loadGruntTasks(grunt, { pattern: ["grunt-*", "grunt-contrib-*"] });
grunt.initConfig({
pkg: grunt.file.readJSON("package.json"),
copy: {
revealSources: {
expand: true,
cwd: "node_modules/reveal.js/.",
src: [
"{js,lib,plugin}/**",
"css/{reveal.scss,reset.css}",
"css/print/**",
"css/theme/template/**",
"index.html",
"package*.json",
"Gruntfile.js"
],
dest: BUILD_DIR
},
themeSources: {
expand: true,
cwd: "src/",
src: ["**"],
dest: BUILD_DIR
},
dist: {
expand: true,
cwd: BUILD_DIR,
src: ["{js,lib,plugin}/**", "css/**/*.css", "index.html"],
dest: DIST_DIR
}
},
exec: {
npmInstall: {
command: "npm install",
options: {
cwd: BUILD_DIR
}
},
buildRevealJs: {
command: "grunt css jshint",
options: {
cwd: BUILD_DIR
}
}
},
clean: [BUILD_DIR + "**", DIST_DIR + "**"]
});
grunt.registerTask("default", ["installRevealJs", "build"]);
grunt.registerTask("installRevealJs", [
"copy:revealSources",
"exec:npmInstall"
]);
grunt.registerTask("build", [
"copy:themeSources",
"exec:buildRevealJs",
"copy:dist"
]);
};
export SHELL := /bin/bash
.PHONY: all clean dist
all: dist
clean:
npx rimraf build/ dist/ node_modules/
dist: build/js/reveal.min.js build/css/theme/irstea.css | dist/
cp -a build/{js,lib,plugin} dist/
mkdir -p dist/css/theme
cp -a build/css/{print,*.css} dist/css
cp -a build/css/theme/irstea.css dist/css/theme
build/js/reveal.min.js: build/node_modules/
cd build; node_modules/.bin/grunt jshint uglify
build/css/theme/irstea.css: build/css/theme/source/irstea.scss build/node_modules/
cd build; node_modules/.bin/grunt css
build/css/theme/source/irstea.scss: build/
cp -a src/* build/
build/node_modules/: build/package.json
cd build; npm install
build/gruntfile.js build/package.json: node_modules/ | build/
cp -a node_modules/reveal.js/{css,js,lib,plugin,package.json,gruntfile.js} build/
node_modules/: package.json
npm install
build/ dist/:
mkdir -p $@
This diff is collapsed.
......@@ -16,12 +16,6 @@
"author": "Guillaume Perréal",
"license": "MIT",
"devDependencies": {
"grunt": "^1.0.4",
"grunt-cli": "^1.3.2",
"grunt-contrib-clean": "^2.0.0",
"grunt-contrib-copy": "^1.0.0",
"grunt-exec": "^3.0.0",
"load-grunt-tasks": "^5.1.0",
"reveal.js": "^3.8.0"
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment