forked from kepano/obsidian-minimal-publish
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
157 lines (148 loc) · 6.15 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
/*
Minimal Theme compiler for Obsidian
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"
}
},
/* Compile the compressed and uncompressed versions of
the theme using Sass */
sass: {
dist: {
options: {
style: 'compressed'
},
files: {
'src/css/main.min.css' : 'src/scss/index.scss'
}
}
},
/* Minify theme used for distribution and live reload */
cssmin: {
options: {
advanced: false,
aggressiveMerging: false,
mediaMerging: false,
restructuring: false
},
target: {
files: {
'src/css/main.min.css' : 'src/css/main.min.css'
}
}
},
/* Concatenate theme files adding in the commented license, plugin compatibility,
and Style Settings that would otherwise be removed in compression */
concat_css: {
dist: {
files: {
'publish.css': [
'src/css/license.css',
'src/css/root.css',
'src/css/color-schemes/default.css',
'src/css/main.min.css'],
'color-schemes/ayu/publish.css': [
'src/css/license.css',
'src/css/root.css',
'src/css/color-schemes/ayu.css',
'src/css/main.min.css'],
'color-schemes/atom/publish.css': [
'src/css/license.css',
'src/css/root.css',
'src/css/color-schemes/atom.css',
'src/css/main.min.css'],
'color-schemes/ayu/publish.css': [
'src/css/license.css',
'src/css/root.css',
'src/css/color-schemes/ayu.css',
'src/css/main.min.css'],
'color-schemes/catppuccin/publish.css': [
'src/css/license.css',
'src/css/root.css',
'src/css/color-schemes/catppuccin.css',
'src/css/main.min.css'],
'color-schemes/dracula/publish.css': [
'src/css/license.css',
'src/css/root.css',
'src/css/color-schemes/dracula.css',
'src/css/main.min.css'],
'color-schemes/everforest/publish.css': [
'src/css/license.css',
'src/css/root.css',
'src/css/color-schemes/everforest.css',
'src/css/main.min.css'],
'color-schemes/flexoki/publish.css': [
'src/css/license.css',
'src/css/root.css',
'src/css/color-schemes/flexoki.css',
'src/css/main.min.css'],
'color-schemes/gruvbox/publish.css': [
'src/css/license.css',
'src/css/root.css',
'src/css/color-schemes/gruvbox.css',
'src/css/main.min.css'],
'color-schemes/macos/publish.css': [
'src/css/license.css',
'src/css/root.css',
'src/css/color-schemes/macos.css',
'src/css/main.min.css'],
'color-schemes/nord/publish.css': [
'src/css/license.css',
'src/css/root.css',
'src/css/color-schemes/nord.css',
'src/css/main.min.css'],
'color-schemes/sky/publish.css': [
'src/css/license.css',
'src/css/root.css',
'src/css/color-schemes/sky.css',
'src/css/main.min.css'],
'color-schemes/rose-pine/publish.css': [
'src/css/license.css',
'src/css/root.css',
'src/css/color-schemes/rose-pine.css',
'src/css/main.min.css'],
'color-schemes/solarized/publish.css': [
'src/css/license.css',
'src/css/root.css',
'src/css/color-schemes/solarized.css',
'src/css/main.min.css'],
'color-schemes/things/publish.css': [
'src/css/license.css',
'src/css/root.css',
'src/css/color-schemes/things.css',
'src/css/main.min.css']
}
}
},
/* Watch for changes, and compile new changes */
watch: {
css: {
files: ['src/**/*.scss','src/**/*.css'],
tasks: ['env','sass:dist','cssmin','concat_css']
}
}
});
grunt.loadNpmTasks('grunt-env');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-cssmin');
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']);
}