-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathGruntfile.js
More file actions
96 lines (87 loc) · 2.53 KB
/
Gruntfile.js
File metadata and controls
96 lines (87 loc) · 2.53 KB
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
/*
Many people use Grunt, but I sourced this from the exceptional Minimal theme
which can be found here: 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"
}
},
// Create red-graphite.css and red-graphite.min.css from index.scss
sass: {
dist: {
options: {
implementation: require('sass'),
sourceMap: false,
outputStyle: 'compressed'
},
files: {
'src/css/red-graphite.min.css': 'src/scss/index.scss'
}
}
},
// css used for distribution and live reload
cssmin: {
options: {
advanced: false,
aggressiveMerging: false,
mediaMerging: false,
restructuring: false
},
target: {
files: {
'src/css/red-graphite.min.css': 'src/css/red-graphite.min.css'
}
}
},
// Concatenate theme files adding Style Settings
concat_css: {
dist: {
files: {
// 'theme.css': ['src/css/red-graphite.min.css', 'src/css/alternate-checkboxes.css', 'src/css/style-settings.css']
'theme.css': ['src/css/red-graphite.min.css', 'src/css/style-settings.css']
}
}
},
// Put files where they need to go
copy: {
local: {
files: [
{
expand: true,
src: 'theme.css',
dest: "<%= OBSIDIAN_PATH %>"
},
{
expand: true,
src: 'manifest.json',
dest: "<%= OBSIDIAN_PATH %>"
}
]
}
},
// Watch for changes, and compile new changes
watch: {
css: {
files: ['src/**/*.scss', 'src/**/*.css'],
tasks: ['env:local', 'loadconst', 'sass:dist', 'concat_css:dist', 'copy']
}
}
});
grunt.loadNpmTasks('grunt-env');
grunt.loadNpmTasks('grunt-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('build', ['env:local', 'loadconst', 'sass:dist', 'concat_css:dist', 'copy']);
grunt.registerTask('default', ['env:local', 'loadconst', 'watch']);
}