@medyll/cssfabric 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (202) hide show
  1. package/README.md +38 -240
  2. package/_generated/cssFabric.vars.json +13 -0
  3. package/{src/_generated → _generated}/export.variables.md +0 -0
  4. package/{src/_generated → _generated}/index.d.ts +0 -0
  5. package/{src/_generated → _generated}/readme.md +0 -0
  6. package/init/importCssVars.d.ts +1 -0
  7. package/init/importCssVars.js +2 -0
  8. package/package.json +113 -69
  9. package/{lib/scripts → scripts}/cssfabric.d.ts +0 -0
  10. package/scripts/cssfabric.js +43 -0
  11. package/{lib/scripts → scripts}/cssfabricClassNames.d.ts +0 -0
  12. package/{lib/scripts → scripts}/cssfabricClassNames.js +5 -9
  13. package/{src/scripts → scripts}/index.d.ts +0 -0
  14. package/scripts/index.js +4 -0
  15. package/{lib/scripts → scripts}/utils.d.ts +0 -0
  16. package/{lib/scripts → scripts}/utils.js +1 -3
  17. package/{lib/styles/core → styles}/animation/animation.css +0 -0
  18. package/{lib/styles/core → styles}/animation/animation.min.css +0 -0
  19. package/{lib/styles/core → styles}/base/base.css +0 -7
  20. package/styles/base/base.min.css +1 -0
  21. package/styles/box/box.css +1379 -0
  22. package/styles/box/box.min.css +1 -0
  23. package/styles/box/box.responsive.css +5524 -0
  24. package/styles/box/box.responsive.min.css +1 -0
  25. package/styles/color/color.css +1565 -0
  26. package/styles/color/color.min.css +1 -0
  27. package/styles/color/color.responsive.css +6268 -0
  28. package/styles/color/color.responsive.min.css +1 -0
  29. package/styles/cssfabric.css +61792 -0
  30. package/styles/cssfabric.min.css +168 -0
  31. package/styles/cssfabric.responsive.css +200596 -0
  32. package/styles/cssfabric.responsive.min.css +108 -0
  33. package/{lib/styles/core → styles}/flex/flex.css +0 -0
  34. package/styles/flex/flex.min.css +1 -0
  35. package/{lib/styles/core → styles}/flex/flex.responsive.css +0 -126
  36. package/styles/flex/flex.responsive.min.css +1 -0
  37. package/{lib/styles/core → styles}/grid/grid.css +0 -0
  38. package/styles/grid/grid.min.css +1 -0
  39. package/{lib/styles/core → styles}/grid/grid.responsive.css +0 -121
  40. package/styles/grid/grid.responsive.min.css +1 -0
  41. package/{lib/styles/core → styles}/menu/menu.css +16 -12
  42. package/styles/menu/menu.min.css +1 -0
  43. package/{lib/styles/core → styles}/menu/menu.responsive.css +64 -129
  44. package/styles/menu/menu.responsive.min.css +1 -0
  45. package/{lib/styles/core → styles}/overflow/overflow.css +0 -0
  46. package/{lib/styles/core → styles}/overflow/overflow.min.css +0 -0
  47. package/{lib/styles/core → styles}/overflow/overflow.responsive.css +0 -61
  48. package/styles/overflow/overflow.responsive.min.css +1 -0
  49. package/{lib/styles/core → styles}/scale/scale.css +286 -206
  50. package/styles/scale/scale.min.css +1 -0
  51. package/styles/scale/scale.responsive.css +2884 -0
  52. package/styles/scale/scale.responsive.min.css +1 -0
  53. package/{lib/styles/core → styles}/table/table.css +0 -0
  54. package/styles/table/table.min.css +1 -0
  55. package/{lib/styles/core → styles}/table/table.responsive.css +0 -74
  56. package/styles/table/table.responsive.min.css +1 -0
  57. package/{lib/styles/core → styles}/text/text.css +4 -0
  58. package/styles/text/text.min.css +1 -0
  59. package/styles/text/text.responsive.css +196 -0
  60. package/styles/text/text.responsive.min.css +1 -0
  61. package/{lib/styles/core → styles}/theme/theme.css +0 -0
  62. package/{lib/styles/core → styles}/theme/theme.min.css +0 -0
  63. package/styles/vars.css +414 -0
  64. package/styles/vars.min.css +1 -0
  65. package/{lib/styles/core → styles}/zindex/zindex.css +0 -0
  66. package/{lib/styles/core → styles}/zindex/zindex.min.css +0 -0
  67. package/.idea/cssfabric.iml +0 -8
  68. package/.idea/misc.xml +0 -9
  69. package/.idea/modules.xml +0 -8
  70. package/.idea/vcs.xml +0 -6
  71. package/.vscode/settings.json +0 -24
  72. package/bin/index.js +0 -7
  73. package/cssfabric.config.js +0 -3
  74. package/cssfabric.json +0 -8
  75. package/gulpfile.js +0 -598
  76. package/lib/_generated/export.variables.json +0 -583
  77. package/lib/index.d.ts +0 -2
  78. package/lib/index.js +0 -7
  79. package/lib/scripts/cssfabric.js +0 -48
  80. package/lib/scripts/index.d.ts +0 -2
  81. package/lib/scripts/index.js +0 -6
  82. package/lib/styles/core/base/base.min.css +0 -1
  83. package/lib/styles/core/box/box.css +0 -2449
  84. package/lib/styles/core/box/box.min.css +0 -1
  85. package/lib/styles/core/box/box.responsive.css +0 -12255
  86. package/lib/styles/core/box/box.responsive.min.css +0 -1
  87. package/lib/styles/core/color/color.css +0 -923
  88. package/lib/styles/core/color/color.min.css +0 -1
  89. package/lib/styles/core/color/color.responsive.css +0 -4625
  90. package/lib/styles/core/color/color.responsive.min.css +0 -1
  91. package/lib/styles/core/flex/flex.min.css +0 -1
  92. package/lib/styles/core/flex/flex.responsive.min.css +0 -1
  93. package/lib/styles/core/grid/grid.min.css +0 -1
  94. package/lib/styles/core/grid/grid.responsive.min.css +0 -1
  95. package/lib/styles/core/main.min.css +0 -1
  96. package/lib/styles/core/menu/menu.min.css +0 -1
  97. package/lib/styles/core/menu/menu.responsive.min.css +0 -1
  98. package/lib/styles/core/overflow/overflow.responsive.min.css +0 -1
  99. package/lib/styles/core/scale/scale.min.css +0 -1
  100. package/lib/styles/core/scale/scale.responsive.css +0 -3205
  101. package/lib/styles/core/scale/scale.responsive.min.css +0 -1
  102. package/lib/styles/core/table/table.min.css +0 -1
  103. package/lib/styles/core/table/table.responsive.min.css +0 -1
  104. package/lib/styles/core/text/text.min.css +0 -1
  105. package/lib/styles/core/text/text.responsive.css +0 -745
  106. package/lib/styles/core/text/text.responsive.min.css +0 -1
  107. package/lib/styles/core/vars.css +0 -274
  108. package/lib/styles/core/vars.min.css +0 -1
  109. package/lib/styles/cssfabric.css +0 -5367
  110. package/lib/styles/cssfabric.min.css +0 -15
  111. package/lib/styles/cssfabric.responsive.css +0 -23164
  112. package/lib/styles/cssfabric.responsive.min.css +0 -9
  113. package/src/_generated/export.variables.json +0 -760
  114. package/src/cssfabric/_utils.scss +0 -193
  115. package/src/cssfabric/index.d.ts +0 -3
  116. package/src/cssfabric/modules/_cssfabric-config.scss +0 -93
  117. package/src/cssfabric/modules/_mixins.scss +0 -1
  118. package/src/cssfabric/modules/animation/_animation-vars.scss +0 -17
  119. package/src/cssfabric/modules/animation/animation.scss +0 -3
  120. package/src/cssfabric/modules/base/_base-vars.scss +0 -19
  121. package/src/cssfabric/modules/base/base.scss +0 -80
  122. package/src/cssfabric/modules/box/_box-build.scss +0 -268
  123. package/src/cssfabric/modules/box/_box-vars.scss +0 -119
  124. package/src/cssfabric/modules/box/box-responsive.scss +0 -18
  125. package/src/cssfabric/modules/box/box.scss +0 -3
  126. package/src/cssfabric/modules/color/_color-build.scss +0 -108
  127. package/src/cssfabric/modules/color/_color-vars.scss +0 -80
  128. package/src/cssfabric/modules/color/color-responsive.scss +0 -23
  129. package/src/cssfabric/modules/color/color.scss +0 -9
  130. package/src/cssfabric/modules/css-fabric.scss +0 -2
  131. package/src/cssfabric/modules/flex/_flex-build.scss +0 -150
  132. package/src/cssfabric/modules/flex/_flex-vars.scss +0 -84
  133. package/src/cssfabric/modules/flex/flex-responsive.scss +0 -25
  134. package/src/cssfabric/modules/flex/flex.scss +0 -3
  135. package/src/cssfabric/modules/grid/_grid-build.scss +0 -84
  136. package/src/cssfabric/modules/grid/_grid-vars.scss +0 -88
  137. package/src/cssfabric/modules/grid/grid-responsive.scss +0 -25
  138. package/src/cssfabric/modules/grid/grid.scss +0 -6
  139. package/src/cssfabric/modules/menu/_menu-build.scss +0 -119
  140. package/src/cssfabric/modules/menu/_menu-vars.scss +0 -29
  141. package/src/cssfabric/modules/menu/menu-responsive.scss +0 -19
  142. package/src/cssfabric/modules/menu/menu.scss +0 -6
  143. package/src/cssfabric/modules/overflow/_overflow-build.scss +0 -22
  144. package/src/cssfabric/modules/overflow/_overflow-vars.scss +0 -31
  145. package/src/cssfabric/modules/overflow/overflow-responsive.scss +0 -25
  146. package/src/cssfabric/modules/overflow/overflow.scss +0 -7
  147. package/src/cssfabric/modules/scale/_scale-build.scss +0 -129
  148. package/src/cssfabric/modules/scale/_scale-vars.scss +0 -75
  149. package/src/cssfabric/modules/scale/scale-responsive.scss +0 -23
  150. package/src/cssfabric/modules/scale/scale.scss +0 -8
  151. package/src/cssfabric/modules/table/_table-build.scss +0 -134
  152. package/src/cssfabric/modules/table/_table-vars.scss +0 -30
  153. package/src/cssfabric/modules/table/table-responsive.scss +0 -24
  154. package/src/cssfabric/modules/table/table.scss +0 -8
  155. package/src/cssfabric/modules/text/_text-build.scss +0 -109
  156. package/src/cssfabric/modules/text/_text-vars.scss +0 -87
  157. package/src/cssfabric/modules/text/text-responsive.scss +0 -25
  158. package/src/cssfabric/modules/text/text.scss +0 -6
  159. package/src/cssfabric/modules/theme/_theme-build.scss +0 -76
  160. package/src/cssfabric/modules/theme/_theme-vars.scss +0 -55
  161. package/src/cssfabric/modules/theme/theme.scss +0 -6
  162. package/src/cssfabric/modules/vars.scss +0 -118
  163. package/src/cssfabric/modules/zindex/_zindex-vars.scss +0 -14
  164. package/src/cssfabric/modules/zindex/zindex.scss +0 -15
  165. package/src/index.d.ts +0 -3
  166. package/src/index.ts +0 -4
  167. package/src/scripts/cssfabric.ts +0 -54
  168. package/src/scripts/cssfabricClassNames.ts +0 -216
  169. package/src/scripts/index.ts +0 -8
  170. package/src/scripts/utils.ts +0 -37
  171. package/src/vendor/index.d.ts +0 -3
  172. package/src/vendor/normalize/normalize.min.css +0 -2
  173. package/src/vendor/sass-json-export/CHANGELOG.md +0 -26
  174. package/src/vendor/sass-json-export/Gruntfile.js +0 -60
  175. package/src/vendor/sass-json-export/LICENSE +0 -20
  176. package/src/vendor/sass-json-export/README.md +0 -90
  177. package/src/vendor/sass-json-export/package.json +0 -60
  178. package/src/vendor/sass-json-export/stylesheets/encode/api/_json.scss +0 -26
  179. package/src/vendor/sass-json-export/stylesheets/encode/encode.scss +0 -17
  180. package/src/vendor/sass-json-export/stylesheets/encode/helpers/_quote.scss +0 -9
  181. package/src/vendor/sass-json-export/stylesheets/encode/mixins/_json.scss +0 -42
  182. package/src/vendor/sass-json-export/stylesheets/encode/types/_bool.scss +0 -7
  183. package/src/vendor/sass-json-export/stylesheets/encode/types/_color.scss +0 -8
  184. package/src/vendor/sass-json-export/stylesheets/encode/types/_list.scss +0 -14
  185. package/src/vendor/sass-json-export/stylesheets/encode/types/_map.scss +0 -15
  186. package/src/vendor/sass-json-export/stylesheets/encode/types/_null.scss +0 -7
  187. package/src/vendor/sass-json-export/stylesheets/encode/types/_number.scss +0 -8
  188. package/src/vendor/sass-json-export/stylesheets/encode/types/_string.scss +0 -8
  189. package/src/vendor/sass-json-export/stylesheets/sass-json-export.scss +0 -2
  190. package/src/vendor/sass-json-export/test/encode/_index.scss +0 -14
  191. package/src/vendor/sass-json-export/test/encode/api/_json.scss +0 -29
  192. package/src/vendor/sass-json-export/test/encode/helpers/_quote.scss +0 -6
  193. package/src/vendor/sass-json-export/test/encode/types/_bool.scss +0 -6
  194. package/src/vendor/sass-json-export/test/encode/types/_color.scss +0 -7
  195. package/src/vendor/sass-json-export/test/encode/types/_list.scss +0 -25
  196. package/src/vendor/sass-json-export/test/encode/types/_map.scss +0 -17
  197. package/src/vendor/sass-json-export/test/encode/types/_null.scss +0 -8
  198. package/src/vendor/sass-json-export/test/encode/types/_number.scss +0 -68
  199. package/src/vendor/sass-json-export/test/encode/types/_string.scss +0 -9
  200. package/src/vendor/sass-json-export/test/test.scss +0 -9
  201. package/tsconfig.json +0 -46
  202. package/webpack.config.js +0 -53
package/gulpfile.js DELETED
@@ -1,598 +0,0 @@
1
- // ## WIP
2
-
3
- const gulp = require("gulp"),
4
- jsonTransform = require("gulp-json-transform"),
5
- cache = require("gulp-cached"),
6
- gulpSass = require("gulp-sass"),
7
- gulFileList = require("gulp-filelist"),
8
- minifyCss = require("gulp-minify-css"),
9
- fs = require("fs"),
10
- gulpRename = require("gulp-rename"),
11
- gulpDownload = require("gulp-download-stream"),
12
- gulpConcat = require("gulp-concat-util"),
13
- gulpJsBeautifier = require('gulp-jsbeautifier'),
14
- modifyFile = require("gulp-modify-file"),
15
- json2md = require("json2md"),
16
- gulpIgnore = require("gulp-ignore");
17
-
18
-
19
- gulpSass.compiler = require("sass");
20
-
21
- const fabricConfig = require("./cssfabric.json");
22
-
23
- const {
24
- fabricRootDir,
25
- fabricStylesDir,
26
- fabricConfDir,
27
- fabricModuleDir,
28
- fabricGeneratedDir,
29
- } = fabricConfig;
30
-
31
- const doFabric = {
32
- /**
33
- * build readme fragment from _generated json file
34
- * @param file_content
35
- * @param file_info
36
- * @returns {{}}
37
- */
38
- fabricReadmeFile: (file_content, file_info) => {
39
- // name of the module, from path
40
- const fileContent = file_content || {}
41
- const moduleList = fileContent?.cssfabric?.modules;
42
-
43
- let out = [];
44
- const content = [];
45
- const docContent = [];
46
-
47
- const table = {headers: ["modules", ""]};
48
- const rows = [];
49
-
50
- const labelIn = "<span style='width:80px;display:inline-block;overflow:visible'><b>";
51
- const labelOut = "</b></span>";
52
-
53
- const labelNestedIn = "<span style='margin-left:20px;width:80px;display:inline-block;overflow:visible'>- ";
54
- const labelNestedOut = "</span>";
55
-
56
- const eol = '<br>&nbsp;&nbsp;-&nbsp;&nbsp;';
57
-
58
- out.push({h1: "Welcome to cssfabric"});
59
- out.push({p: "Willing to bring my utility-first 2011 css framework to a more decent life !"});
60
- out.push({p: "This is also a learning point about gulp, webpack, packages and friends."});
61
- out.push({blockquote: "yaocf !"});
62
- out.push({p: "<br/>"});
63
- out.push({h2: "Incoming features"});
64
- out.push({p: "<br/>"});
65
-
66
- Object.keys(moduleList).forEach((moduleListKey, moduleListIndex, a) => {
67
- const moduleListValue = moduleList[moduleListKey];
68
-
69
- let title = moduleListValue?._metadata?.title;
70
- let description = moduleListValue?._metadata?.description;
71
- let docs = moduleListValue?._docs || {};
72
-
73
- let config = Object.keys(moduleListValue?._data);
74
- let cssProps = config?.cssProps;
75
- let collect;
76
- let collectContentList;
77
- let nestedLevels;
78
-
79
-
80
- if (docs?.attributes) {
81
-
82
- docContent.push({hr: ''});
83
- docContent.push({h4: `<strong>module ${title}</strong>`});
84
-
85
-
86
- Object.keys(docs.attributes).forEach((attributeCode) => {
87
-
88
- collectContentList = [];
89
- collect = {};
90
- nestedLevels = [];
91
-
92
- const attributeValue = docs.attributes[attributeCode];
93
- // looking for tag
94
-
95
- if (typeof attributeValue === "object" && !Array.isArray(attributeValue)) {
96
- collect.title = `[${attributeCode}]`;
97
- // si tag
98
- if (attributeValue?.tag) {
99
- collect.tag = `${labelIn}shorthand${labelOut}: ${attributeValue.tag}`;
100
- }
101
- // si about
102
- if (attributeValue?.about) {
103
- collect.about = `- ${attributeValue.about}`;
104
- }
105
- // si keys
106
- if (attributeValue?.keys) {
107
- console.log(title,'keys isArrayOfType ', isArrayOfType(attributeValue.keys))
108
- switch (isArrayOfType(attributeValue.keys)) {
109
- case "strings":
110
- case "numbers":
111
- collect.keys = `${labelIn}keys${labelOut}: ${attributeValue.keys.join('&nbsp;&nbsp;')}`;
112
- break;
113
- case "arrays":
114
- collect.keys = `${labelIn}keys${labelOut}:${eol}` + attributeValue.keys.map((x) => x.join('&nbsp;&nbsp;')).join(eol)
115
- break;
116
- case "objects":
117
- break;
118
- }
119
- }
120
- // si levels
121
- if (attributeValue?.levels) {
122
- // si typeof level array => array of string or of arrays
123
- if (Array.isArray(attributeValue.levels)) {
124
- // if [][]
125
- console.log(title,'levels isArrayOfType ', isArrayOfType(attributeValue.levels))
126
- switch (isArrayOfType(attributeValue.levels)) {
127
- case "strings":
128
- case "numbers":
129
- collect.levels = `${labelIn}levels${labelOut}: ${eol}${attributeValue.levels.join('&nbsp;&nbsp;')}`;
130
- break;
131
- case "arrays":
132
- collect.levels = `${labelIn}levels${labelOut}:${eol}` + attributeValue.levels.map((x) => x.join('&nbsp;&nbsp;')).join(eol)
133
- break;
134
-
135
- }
136
-
137
- // if {}[] ..... ?
138
- if (attributeValue.levels.every(x => typeof x === 'object' && !Array.isArray(x))) {
139
- collect.levels = `${labelIn}levels${labelOut}: ${eol}${attributeValue.levels.map((x) => x.join('&nbsp;&nbsp;')).join(eol)}`;
140
- }
141
-
142
- }
143
- // si typeof level object
144
- if (!Array.isArray(attributeValue.levels) && typeof (attributeValue.levels === "object")) {
145
- nestedLevels.push(`${labelIn}level keys${labelOut}:`);
146
- Object.keys(attributeValue.levels).forEach((levelKey) => {
147
- let levelValue = attributeValue.levels[levelKey].join('&nbsp;&nbsp;&nbsp;&nbsp;')
148
- // console.log(levelValue)
149
- nestedLevels.push(`${labelNestedIn}${levelKey}${labelNestedOut}: ${levelValue}`);
150
- })
151
- // [].concat(...arr));
152
- }
153
- }
154
- }
155
-
156
- if (collect.title) docContent.push({h4: collect.title});
157
- if (collect.about) docContent.push({"p": collect.about});
158
-
159
- if (collect.tag) collectContentList.push(collect.tag);
160
- if (collect.keys) collectContentList.push(collect.keys);
161
- if (collect.levels) collectContentList.push(collect.levels);
162
-
163
- if (nestedLevels && nestedLevels.length) collectContentList.push(nestedLevels.join('<br/>'));
164
-
165
- docContent.push({"ul": collectContentList});
166
-
167
- // docContent.push({"p": "<br/>"}) ;
168
-
169
- });
170
- //docContent.push({p: '<br/><br/>'});
171
-
172
- }
173
-
174
- rows.push([title, description]);
175
-
176
- });
177
-
178
- function isArrayOfType(arr) {
179
- let ret = '';
180
-
181
- if(!Array.isArray(arr)){
182
- console.log(Array.isArray(arr),{arr})
183
- }
184
- if (arr.every(x => Array.isArray(x))) ret = 'arrays'
185
- if (arr.every(x => typeof x === 'string')) ret = 'strings'
186
- if (arr.every(x => typeof x === 'number')) ret = 'numbers'
187
- if (arr.every(x => typeof x === 'object' && !Array.isArray(x))) ret = 'objects'
188
-
189
- return ret;
190
- }
191
-
192
- console.log({docContent});
193
-
194
-
195
- table.rows = rows;
196
-
197
- out.push({table: table})
198
- out.push({p: "<br/>"});
199
- out.push({ul: content});
200
- out.push({p: "<br/>"});
201
- out.push({h3: "More details"});
202
- out = out.concat(docContent);
203
-
204
- return json2md(out);
205
- },
206
-
207
- /**
208
- * transform scss to json file with all modules variables
209
- * @param file
210
- * @returns {string}
211
- */
212
- fabricSassToJson: (file) => {
213
- let {file_content, file_info} = file;
214
-
215
- let obj;
216
- obj = file_content.obj;
217
- obj = obj.split("|").filter(n => n);
218
-
219
- const redPath = "";
220
- const redModulePath = fabricModuleDir + "/";
221
-
222
- let header = '';
223
- let footer = '';
224
-
225
- let importExport = `@import "./src/${redPath}vendor/sass-json-export/stylesheets/sass-json-export.scss";`;
226
-
227
-
228
- Object.values(obj).forEach((v, k, a) => {
229
- let module_path = redModulePath + v;
230
- let module_name = v
231
- .replace("_", "")
232
- .split("/")
233
- ?.pop()
234
- .split(".")?.[0]
235
- .replace("-vars", "");
236
-
237
- if (v) {
238
- header += makeHeader(module_path, module_name);
239
- footer += makeFooter(module_name);
240
- }
241
- });
242
-
243
- // return ""
244
-
245
- let out = header;
246
- out += "\r\n" + importExport + "\r\n";
247
- out += footer;
248
-
249
- function makeHeader(path, module_name) {
250
- // form is module-vars.$module-config
251
- return '@use "' + path + '.scss" as ' + module_name + "; \r\n";
252
- }
253
-
254
- function makeFooter(module_name) {
255
- // form is module.$module-(config|*)
256
- let out1 = ` ( _data: ${module_name}.$${module_name}-config , _metadata :${module_name}.$${module_name}-metadata , _docs :${module_name}.$${module_name}-docs )`;
257
-
258
- return (
259
- "@include json-encode(" + out1 + ",comment," + module_name + ");\r\n"
260
- );
261
- }
262
-
263
-
264
- return out;
265
- },
266
- // todo use regexp
267
- fabricCssVarExportFile: (filePath) => {
268
- let module_path = filePath
269
- .split("modules/")[1]
270
- .replace("modules", "")
271
- .replace(".scss", "");
272
-
273
- let module_filename = filePath
274
- .substring(filePath.lastIndexOf("/"))
275
- .replace(".scss", "")
276
- .replace("/", "");
277
-
278
- let module_name = filePath
279
- .substring(filePath.lastIndexOf("/_"))
280
- .replace(".scss", "")
281
- .replace("-vars", "")
282
- .replace("_", "")
283
- .replace("/", "");
284
-
285
- return `|{"module_path" : "${module_path}","module_filename" : "${module_filename}","module_name" : "${module_name}"}`;
286
- }
287
- }
288
-
289
-
290
- function fabricVarExportFile(filePath) {
291
- // name of the module, from path
292
- let module_name = filePath
293
- .substring(filePath.lastIndexOf("modules/"))
294
- .split("\\")
295
- ?.pop()
296
- .split(".")?.[0]
297
- .replace("modules/", "");
298
-
299
- return module_name + "|";
300
- }
301
-
302
-
303
- // exports sass maps to json
304
- function task_cssVarsExport(cb) {
305
- let sourceFiles = fabricModuleDir + "/**/_*-vars.scss";
306
- gulp
307
- .src(sourceFiles)
308
- .pipe(
309
- gulFileList("cssfabric-vars.css", {
310
- destRowTemplate: doFabric.fabricCssVarExportFile,
311
- removeExtensions: false,
312
- })
313
- )
314
- .pipe(
315
- modifyFile((content, path, file) => {
316
- let exp = content.split("|"); // JSON.parse()
317
- let header = '';
318
- let footer = "";
319
-
320
- let utils = `@use '${fabricRootDir}/utils' as utils;` + "\r\n";
321
- const openVarTag = ":root{";
322
- const closeVarTag = "}";
323
-
324
- Object.values(exp).forEach((v, k, a) => {
325
- if (v) {
326
- moduleConf = JSON.parse(v);
327
-
328
- if (moduleConf) {
329
- header +=
330
- `@use '${fabricModuleDir}/${moduleConf.module_path}' as ${moduleConf.module_name};` +
331
- "\r\n";
332
- footer +=
333
- `@include utils.scssVarsToCssVars(${moduleConf.module_name},${moduleConf.module_name}.$${moduleConf.module_name}-config);` +
334
- "\r\n";
335
- }
336
- }
337
- });
338
-
339
- const out = utils + header + openVarTag + footer + closeVarTag;
340
-
341
- return out;
342
- })
343
- )
344
- .pipe(gulpSass({outputStyle: "expanded", includePaths: [fabricModuleDir]}).on("error", gulpSass.logError))
345
- .pipe(gulp.dest(fabricStylesDir))
346
- .on("end", () => {
347
- return cb();
348
- });
349
- }
350
-
351
- // exports sass maps to json
352
- function task_varsExport(cb) {
353
- let sourceFiles = fabricModuleDir + "/**/_*-vars.scss";
354
-
355
- gulp
356
- .src(sourceFiles)
357
- //.pipe(cache(task_varsExport))
358
- .pipe(
359
- gulFileList("ghost", {
360
- destRowTemplate: fabricVarExportFile,
361
- removeExtensions: false,
362
- })
363
- )
364
- .pipe(gulpConcat("export-variables.try"))
365
- .pipe(gulpConcat.header('{"obj":"'))
366
- .pipe(gulpConcat.footer('"}'))
367
- .pipe(
368
- jsonTransform(function (file_content, file_info) {
369
- return doFabric.fabricSassToJson({file_content: file_content, file_info});
370
- })
371
- )
372
- .pipe(cache(task_varsExport))
373
- // .pipe(sass().on('error', sass.logError))
374
- .pipe(gulpSass({outputStyle: "expanded"}).on("error", gulpSass.logError))
375
- .pipe(
376
- modifyFile((content, path, file) => {
377
- const start = '{"cssfabric":{"modules":{';
378
- const end = " }}}";
379
-
380
- const regexIn = /\/\*\! json-encode: {/gm;
381
- const regexOut = /} \*\//gm;
382
-
383
- let exp = content
384
- .replace(regexIn, "")
385
- .replace(regexOut, ",")
386
- .replace(/,\s*$/, "");
387
-
388
- return `${start}${exp}${end}`;
389
- })
390
- )
391
- .pipe(gulpJsBeautifier())
392
- .pipe(
393
- gulpRename(function (path) {
394
- path.dirname = path.dirname;
395
- path.extname = ".json";
396
- path.basename = path.basename.replace("-", ".");
397
- })
398
- )
399
- .pipe(gulp.dest(fabricGeneratedDir))
400
- .on("end", () => {
401
- return cb();
402
- });
403
-
404
- return cb();
405
- }
406
-
407
- function task_readme(cb) {
408
- gulp
409
- .src(fabricGeneratedDir + "/*.json")
410
- .pipe(
411
- jsonTransform(function (file_content, file_info) {
412
- return doFabric.fabricReadmeFile(file_content, file_info);
413
- })
414
- )
415
- .pipe(
416
- gulpRename(function (path) {
417
- path.dirname = path.dirname;
418
- path.extname = ".md";
419
- path.basename = path.basename.replace("-", ".");
420
- })
421
- )
422
- .pipe(gulp.dest(fabricGeneratedDir))
423
- .on("end", () => {
424
- return cb();
425
- });
426
- }
427
-
428
- /**
429
- * concatenate css files
430
- * by min | responsive | ...
431
- *
432
- * @param {function} cb gulp callback
433
- */
434
- function task_mergeInclude(cb) {
435
- //
436
- const dest = fabricStylesDir;
437
- const dir = fabricStylesDir + "/core";
438
-
439
- const steps = [];
440
- // normal stylesheets
441
- steps.push(
442
- gulp
443
- .src([
444
- `${dir}/**/*.css`,
445
- `!${dir}/**/*responsive*.css`,
446
- `!${dir}/**/*min*.css`,
447
- ])
448
- .pipe(gulpConcat("cssfabric.css"))
449
- .pipe(gulpConcat.header("/** Merged by Mydde */"))
450
- .pipe(cache(task_mergeInclude))
451
- .pipe(gulp.dest(dest))
452
- .on("end", () => {
453
- return cb();
454
- })
455
- );
456
-
457
- // normal minified stylesheets
458
- steps.push(
459
- gulp
460
- .src([`${dir}/**/*min.css`, `!${dir}/**/*responsive*.css`])
461
- .pipe(gulpConcat("cssfabric.min.css"))
462
- .pipe(cache(task_mergeInclude))
463
- .pipe(gulp.dest(dest))
464
- .on("end", () => {
465
- return cb();
466
- })
467
- );
468
-
469
- // responsive stylesheets
470
- steps.push(
471
- gulp
472
- .src([`${dir}/**/*responsive.css`, `!${dir}/**/*min..css`])
473
- .pipe(gulpConcat("cssfabric.responsive.css"))
474
- .pipe(cache(task_mergeInclude))
475
- .pipe(gulp.dest(dest))
476
- .on("end", () => {
477
- return cb();
478
- })
479
- );
480
-
481
- // responsive minified stylesheets
482
- steps.push(
483
- gulp
484
- .src([`${dir}/**/*responsive.min.css`])
485
- .pipe(gulpConcat("cssfabric.responsive.min.css"))
486
- .pipe(cache(task_mergeInclude))
487
- .pipe(gulp.dest(dest))
488
- .on("end", () => {
489
- return cb();
490
- })
491
- );
492
-
493
- return [...steps];
494
- }
495
-
496
- /**
497
- * task_sass2css
498
- * transform scss to css
499
- * store files in /lib
500
- *
501
- * rename *-responsive to *.responsive, because not dot in sass file
502
- *
503
- * @param {function} cb
504
- * @returns function
505
- */
506
- function task_sass2css(cb) {
507
- return (
508
- gulp
509
- .src(`${fabricModuleDir}/**/*.scss`)
510
- .pipe(gulpIgnore.exclude("**/*css-fabric*"))
511
- .pipe(
512
- gulpRename(function (path) {
513
- /*path.dirname = path.dirname;
514
- path.extname = path.extname;*/
515
- path.basename = path.basename.replace("-", ".");
516
- })
517
- )
518
- // to css and to /core
519
- .pipe(
520
- gulpSass({outputStyle: "expanded"}).on("error", gulpSass.logError)
521
- )
522
- .pipe(gulp.dest(`${fabricStylesDir}/core`))
523
- // to css and minify and to /core
524
- .pipe(
525
- minifyCss({
526
- keepSpecialComments: 0,
527
- })
528
- )
529
- .pipe(
530
- gulpRename(function (path) {
531
- /*path.dirname = path.dirname;*/
532
- path.extname = ".min.css";
533
- path.basename = path.basename.replace("-", ".");
534
- })
535
- )
536
- .pipe(gulp.dest(`${fabricStylesDir}/core`))
537
- .on("end", () => {
538
- return cb();
539
- })
540
- );
541
- }
542
-
543
- function taskDownload(cb) {
544
- return gulpDownload(
545
- "https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.min.css"
546
- )
547
- .pipe(gulp.dest("./src/vendor/normalize/"))
548
- .on("end", () => {
549
- return cb();
550
- });
551
- }
552
-
553
- function watchSassTask(cb) {
554
- gulp.watch(
555
- fabricModuleDir + "/**/*.scss",
556
- gulp.series(task_sass2css, task_mergeInclude, task_varsExport)
557
- );
558
- cb();
559
- }
560
-
561
- // todo change to styleDir
562
- function watchInclude(cb) {
563
-
564
- cb();
565
- }
566
-
567
- function watchReadme(cb) {
568
- gulp.watch(
569
- [fabricModuleDir, "!" + fabricModuleDir + "/**/_*.scss"],
570
- task_readme
571
- );
572
-
573
- cb();
574
- }
575
-
576
- function watchExportVars(cb) {
577
- gulp.watch(fabricRootDir, gulp.series(task_varsExport));
578
-
579
- cb();
580
- }
581
-
582
- function watchCssExportVars(cb) {
583
- gulp.watch(fabricModuleDir, gulp.series(task_cssVarsExport));
584
-
585
- cb();
586
- }
587
-
588
- // only one called by npm
589
- exports.watchSass = watchSassTask;
590
-
591
- exports.watchInclude = watchInclude;
592
- exports.watchReadme = watchReadme;
593
- exports.watchExportVars = watchExportVars;
594
-
595
- exports.watchCssExport = watchCssExportVars;
596
-
597
- exports.taskDownload = taskDownload;
598
- exports.task_readme = task_readme;