Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathpreprocess.js
More file actions
Latest commit
68 lines (55 loc) · 1.79 KB
/
Copy pathpreprocess.js
File metadata and controls
68 lines (55 loc) · 1.79 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
varfs=require('fs-extra');
varpath=require('path');
varsass=require('sass');
varconstants=require('./util/constants');
varcommon=require('./util/common');
varpullCSS=require('./util/pull_css');
varupdateVersion=require('./util/update_version');
// main
makeBuildCSS();
exposePartsInLib();
copyTopojsonFiles();
updateVersion(constants.pathToPlotlyVersion);
// convert scss to css to js and static css file
functionmakeBuildCSS(){
constresult=sass.compile(constants.pathToSCSS,{style: 'compressed'});
// To support application with strict CSP where styles cannot be inlined,
// build a static CSS file that can be included into such applications.
fs.writeFile(constants.pathToCSSDist,String(result.css),function(err){
if(err)throwerr;
});
// css to js to be inlined
pullCSS(result.css,constants.pathToCSSBuild);
}
functionexposePartsInLib(){
varobj={};
varinsert=function(name,folder){
obj[name]=folder+'/'+name;
};
insert('core','src');
insert('calendars','src/components');
constants.allTraces.forEach(function(k){
insert(k,'src/traces');
});
writeLibFiles(obj);
}
functionwriteLibFiles(obj){
for(varnameinobj){
common.writeFile(
path.join(constants.pathToLib,name+'.js'),
["'use strict';",'',"module.exports = require('../"+obj[name]+"');",''].join('\n')
);
}
}
functioncopyTopojsonFiles(){
constFILES_TO_EXCLUDE=['country_names_iso_codes.json'];
fs.copy(
constants.pathToTopojsonSrc,
constants.pathToTopojsonDist,
{
clobber: true,
filter: (filePath)=>!FILES_TO_EXCLUDE.includes(path.basename(filePath))
},
common.throwOnError
);
}