UNPKG

4.15 kBJavaScriptView Raw
1var
2 console = require('better-console'),
3 config = require('./user'),
4 release = require('./project/release')
5;
6
7
8module.exports = {
9
10 banner : release.banner,
11
12 log: {
13 created: function(file) {
14 return 'Created: ' + file;
15 },
16 modified: function(file) {
17 return 'Modified: ' + file;
18 }
19 },
20
21 filenames: {
22 concatenatedCSS : 'semantic.css',
23 concatenatedJS : 'semantic.js',
24 concatenatedMinifiedCSS : 'semantic.min.css',
25 concatenatedMinifiedJS : 'semantic.min.js',
26 concatenatedRTLCSS : 'semantic.rtl.css',
27 concatenatedMinifiedRTLCSS : 'semantic.rtl.min.css'
28 },
29
30 regExp: {
31
32 comments: {
33
34 // remove all comments from config files (.variable)
35 variables : {
36 in : /(\/\*[\s\S]+?\*\/+)[\s\S]+?\/\* End Config \*\//,
37 out : '$1',
38 },
39
40 // add version to first comment
41 license: {
42 in : /(^\/\*[\s\S]+)(# Semantic UI )([\s\S]+?\*\/)/,
43 out : '$1$2' + release.version + ' $3'
44 },
45
46 // adds uniform spacing around comments
47 large: {
48 in : /(\/\*\*\*\*[\s\S]+?\*\/)/mg,
49 out : '\n\n$1\n'
50 },
51 small: {
52 in : /(\/\*---[\s\S]+?\*\/)/mg,
53 out : '\n$1\n'
54 },
55 tiny: {
56 in : /(\/\* [\s\S]+? \*\/)/mg,
57 out : '\n$1'
58 }
59 },
60
61 theme: /.*(\/|\\)themes(\/|\\).*?(?=(\/|\\))/mg
62
63 },
64
65 settings: {
66
67 /* Remove Files in Clean */
68 del: {
69 silent : true
70 },
71
72 concatCSS: {
73 rebaseUrls: false
74 },
75
76 /* Comment Banners */
77 header: {
78 title : release.title,
79 version : release.version,
80 repository : release.repository,
81 url : release.url
82 },
83
84 plumber: {
85 less: {
86 errorHandler: function(error) {
87 var
88 regExp = {
89 variable : /@(\S.*?)\s/,
90 theme : /themes[\/\\]+(.*?)[\/\\].*/,
91 element : /[\/\\]([^\/\\*]*)\.overrides/
92 },
93 theme,
94 element
95 ;
96 if(error.filename.match(/theme.less/)) {
97 if (error.line == 9) {
98 element = regExp.variable.exec(error.message)[1];
99 if (element) {
100 console.error('Missing theme.config value for ', element);
101 }
102 console.error('Most likely new UI was added in an update. You will need to add missing elements from theme.config.example');
103 } else if (error.line == 73) {
104 element = regExp.element.exec(error.message)[1];
105 theme = regExp.theme.exec(error.message)[1];
106 console.error(theme + ' is not an available theme for ' + element);
107 } else {
108 console.error(error);
109 }
110 }
111 else {
112 throw new Error(error);
113 }
114 this.emit('end');
115 }
116 }
117 },
118
119 /* What Browsers to Prefix */
120 prefix: {
121 overrideBrowserslist: [
122 'last 2 versions',
123 '> 1%',
124 'opera 12.1',
125 'bb 10',
126 'android 4'
127 ]
128 },
129
130 /* File Renames */
131 rename: {
132 minJS : { extname : '.min.js' },
133 minCSS : { extname : '.min.css' },
134 rtlCSS : { extname : '.rtl.css' },
135 rtlMinCSS : { extname : '.rtl.min.css' }
136 },
137
138 /* Minified CSS Concat */
139 minify: {
140 processImport : false,
141 restructuring : false,
142 keepSpecialComments : 1,
143 roundingPrecision : -1,
144 },
145
146 /* Minified JS Settings */
147 uglify: {
148 mangle : true,
149 output: {
150 comments: 'some'
151 }
152 },
153
154 /* Minified Concat CSS Settings */
155 concatMinify: {
156 processImport : false,
157 restructuring : false,
158 keepSpecialComments : false,
159 roundingPrecision : -1,
160 },
161
162 /* Minified Concat JS */
163 concatUglify: {
164 mangle : true,
165 output: {
166 comments: 'some'
167 }
168 }
169
170 }
171};