-
Notifications
You must be signed in to change notification settings - Fork 0
/
sass-eo-cli.js
215 lines (203 loc) · 6.15 KB
/
sass-eo-cli.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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
module.exports = function (grunt) {
require('load-grunt-tasks')(grunt)
// node-glob syntax
const includeAllSassFiles = [
'./styles/*.scss',
'./components/**/*.scss',
'./layouts/**/*.scss',
]
// sass files path (destination: source)
const sassPath = {
'./styles/globals.css': './styles/globals.scss',
'./styles/home.module.css': './styles/home.module.scss',
'./components/typing/typing.module.css':
'./components/typing/typing.module.scss',
'./components/contrib/contrib.module.css':
'./components/contrib/contrib.module.scss',
'./components/participant/participant.module.css':
'./components/participant/participant.module.scss',
'./components/details/details.module.css':
'./components/details/details.module.scss',
'./layouts/sidebar/SidebarLayout.module.css':
'./layouts/sidebar/SidebarLayout.module.scss',
'./layouts/footer/FooterLayout.module.css':
'./layouts/footer/FooterLayout.module.scss',
'./components/sponsor/sponsor.module.css':
'./components/sponsor/sponsor.module.scss',
}
grunt.initConfig({
pkg: grunt.file.readJSON('./package.json'),
sass: {
dist: {
options: {
style: 'compressed',
loadPath: ['./node_modules/@raja_rakoto/sass-eo'],
},
files: sassPath,
},
},
watch: {
sass: {
files: includeAllSassFiles,
tasks: ['sass:dist'],
options: { spawn: false },
},
},
shell: {
sseo_docs: {
command: [
'cd ./node_modules/@raja_rakoto/sass-eo/',
'sassdoc .',
'cd sassdoc',
'xdg-open index.html',
].join('&&'),
},
loaders_docs: {
command: [
'cd ./node_modules/@raja_rakoto/sass-eo/',
'cd docs/loaders',
'xdg-open index.html',
].join('&&'),
},
magic_docs: {
command: [
'cd ./node_modules/@raja_rakoto/sass-eo/',
'cd docs/magic',
'xdg-open index.html',
].join('&&'),
},
milligrid_docs: {
command: [
'cd ./node_modules/@raja_rakoto/sass-eo/',
'cd docs/milligrid',
'xdg-open index.html',
].join('&&'),
},
hamburgers_config: {
command: [
'cd ./node_modules/@raja_rakoto/sass-eo/',
'cd modules/libs',
'xdg-open _hamburgers.scss',
].join('&&'),
},
grid_maker: {
command: [
'cd ./node_modules/@raja_rakoto/sass-eo/',
'cd modules/apps/grid-maker',
'xdg-open index.html',
].join('&&'),
},
flexbox_maker: {
command: [
'cd ./node_modules/@raja_rakoto/sass-eo/',
'cd modules/apps/flexbox-maker',
'xdg-open index.html',
].join('&&'),
},
buttons_maker: {
command: [
'cd ./node_modules/@raja_rakoto/sass-eo/',
'cd modules/apps/',
'xdg-open btn-maker.html',
].join('&&'),
},
boxshadow_maker: {
command: [
'cd ./node_modules/@raja_rakoto/sass-eo/',
'cd modules/apps/',
'xdg-open box-shadow-maker.html',
].join('&&'),
},
},
})
// watch
grunt.registerTask('watch-sass', ['watch:sass'])
// docs
grunt.registerTask('sseo-docs', ['shell:sseo_docs'])
grunt.registerTask('loaders-docs', ['shell:loaders_docs'])
grunt.registerTask('magic-docs', ['shell:magic_docs'])
grunt.registerTask('milligrid-docs', ['shell:milligrid_docs'])
// config
grunt.registerTask('hamburgers-config', ['shell:hamburgers_config'])
//maker
grunt.registerTask('grid-maker', ['shell:grid_maker'])
grunt.registerTask('flexbox-maker', ['shell:flexbox_maker'])
grunt.registerTask('buttons-maker', ['shell:buttons_maker'])
grunt.registerTask('boxshadow-maker', ['shell:boxshadow_maker'])
// all tasks lists
const sasseoCommandList = [
'watch-sass',
'sseo-docs',
'loaders-docs',
'magic-docs',
'milligrid-docs',
'hamburgers-config',
'grid-maker',
'flexbox-maker',
'buttons-maker',
'boxshadow-maker',
]
const sasseoCommandStatus = [
'watch all .scss files',
'generate sassdoc for basics modules',
'generate loaders docs',
'generate magic docs',
'generate milligrid docs',
'customize your hamburgers',
'open grid maker app',
'open flexbox maker app',
'open buttons maker app',
'open box shadow maker app',
]
// default tasks
grunt.registerTask('default', () => {
console.log(
'\nHere are the lists of executable commands with sass-eo-cli:'.green,
)
/**
*
* @param {string} taskTitle - task title (Eg: basics tasks)
* @param {array} taskNames - task names (Eg: basicsTaskNames)
* @param {array} taskStatus - task status (Eg: basicsTaskStatus)
* @param {string} taskTheme - colors of theme (Eg: black ,red ,green ,yellow ,blue ,magenta ,cyan ,white ,gray ,grey)
*/
function getTaskResume(taskTitle, taskNames, taskStatus, taskTheme) {
switch (taskTheme) {
case 'cyan':
console.log(`\n${taskTitle}`.cyan.inverse.bold)
taskNames.forEach((taskNames, index) => {
console.log(taskNames.cyan + ` -> ${taskStatus[index]}`)
})
break
case 'magenta':
console.log(`\n${taskTitle}`.magenta.inverse.bold)
taskNames.forEach((taskNames, index) => {
console.log(taskNames.magenta + ` -> ${taskStatus[index]}`)
})
break
case 'yellow':
console.log(`\n${taskTitle}`.yellow.inverse.bold)
taskNames.forEach((taskNames, index) => {
console.log(taskNames.yellow + ` -> ${taskStatus[index]}`)
})
break
case 'blue':
console.log(`\n${taskTitle}`.blue.inverse.bold)
taskNames.forEach((taskNames, index) => {
console.log(taskNames.blue + ` -> ${taskStatus[index]}`)
})
break
default:
null
break
}
}
// command resume
getTaskResume(
'💜 SASS-EO CLI 💜',
sasseoCommandList,
sasseoCommandStatus,
'magenta',
)
})
}