generated from obsidianmd/obsidian-sample-theme
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGruntfile.js
68 lines (60 loc) · 1.63 KB
/
Gruntfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/*
Minimal Theme compiler for Obsidian
Tweaked for Apex by @clearlysid
MIT License
Copyright (c) 2020-2021 Stephan Ango (@kepano)
Grunt is JS library that runs a sequence of compilation tasks, and watches
the working files to automatically run this sequence whenever changes happen.
Read more at gruntjs.com
See readme for more details:
https://github.com/kepano/obsidian-minimal
*/
module.exports = function (grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
/* Get the user-defined OBSIDIAN_PATH from .env file
so that we can live reload the theme in the vault */
env: {
local: {
src: ".env"
}
},
/* Concatenate src css files into theme.css */
concat_css: {
dist: {
files: {
'theme.css': ['src/*.css']
}
}
},
/* Copy the finished theme files to the vault */
copy: {
local: {
expand: true,
src: 'theme.css',
dest: process.env.HOME + process.env.OBSIDIAN_PATH,
rename: (dest, src) => dest + 'Apex/theme.css'
},
manifest: {
expand: true,
src: 'manifest.json',
dest: process.env.HOME + process.env.OBSIDIAN_PATH + 'Apex/'
}
},
/* Watch for changes, and compile new changes */
watch: {
css: {
files: ['src/*.css'],
tasks: ['env', 'concat_css', 'copy',]
}
}
});
grunt.loadNpmTasks('grunt-env');
grunt.loadNpmTasks('grunt-concat-css');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask('loadconst', 'Load constants', function () {
grunt.config('OBSIDIAN_PATH', process.env.OBSIDIAN_PATH);
});
grunt.registerTask('default', ['env:local', 'loadconst', 'watch']);
}