Skip to content

Commit ac6af51

Browse files
committed
Linting/formatting
1 parent 350e247 commit ac6af51

File tree

1 file changed

+29
-32
lines changed

1 file changed

+29
-32
lines changed

tasks/preprocess.js

Lines changed: 29 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,32 @@ updateVersion(constants.pathToPlotlyVersion);
1616

1717
// convert scss to css to js and static css file
1818
function makeBuildCSS() {
19-
sass.render({
20-
file: constants.pathToSCSS,
21-
outputStyle: 'compressed'
22-
}, function(err, result) {
23-
if(err) throw err;
19+
sass.render(
20+
{
21+
file: constants.pathToSCSS,
22+
outputStyle: 'compressed'
23+
},
24+
function (err, result) {
25+
if (err) throw err;
2426

25-
// To support application with strict CSP where styles cannot be inlined,
26-
// build a static CSS file that can be included into such applications.
27-
var staticCSS = String(result.css);
28-
for(var k in mapBoxGLStyleRules) {
29-
staticCSS = addAdditionalCSSRules(staticCSS, '.js-plotly-plot .plotly .mapboxgl-' + k, mapBoxGLStyleRules[k]);
30-
}
31-
fs.writeFile(constants.pathToCSSDist, staticCSS, function(err) {
32-
if(err) throw err;
33-
});
27+
// To support application with strict CSP where styles cannot be inlined,
28+
// build a static CSS file that can be included into such applications.
29+
var staticCSS = String(result.css);
30+
for (var k in mapBoxGLStyleRules) {
31+
staticCSS = addAdditionalCSSRules(
32+
staticCSS,
33+
'.js-plotly-plot .plotly .mapboxgl-' + k,
34+
mapBoxGLStyleRules[k]
35+
);
36+
}
37+
fs.writeFile(constants.pathToCSSDist, staticCSS, function (err) {
38+
if (err) throw err;
39+
});
3440

35-
// css to js to be inlined
36-
pullCSS(String(result.css), constants.pathToCSSBuild);
37-
});
41+
// css to js to be inlined
42+
pullCSS(String(result.css), constants.pathToCSSBuild);
43+
}
44+
);
3845
}
3946

4047
function addAdditionalCSSRules(staticStyleString, selector, style) {
@@ -44,40 +51,30 @@ function addAdditionalCSSRules(staticStyleString, selector, style) {
4451
function exposePartsInLib() {
4552
var obj = {};
4653

47-
var insert = function(name, folder) {
54+
var insert = function (name, folder) {
4855
obj[name] = folder + '/' + name;
4956
};
5057

5158
insert('core', 'src');
5259

5360
insert('calendars', 'src/components');
5461

55-
constants.allTraces.forEach(function(k) {
62+
constants.allTraces.forEach(function (k) {
5663
insert(k, 'src/traces');
5764
});
5865

5966
writeLibFiles(obj);
6067
}
6168

6269
function writeLibFiles(obj) {
63-
for(var name in obj) {
70+
for (var name in obj) {
6471
common.writeFile(
6572
path.join(constants.pathToLib, name + '.js'),
66-
[
67-
'\'use strict\';',
68-
'',
69-
'module.exports = require(\'../' + obj[name] + '\');',
70-
''
71-
].join('\n')
73+
["'use strict';", '', "module.exports = require('../" + obj[name] + "');", ''].join('\n')
7274
);
7375
}
7476
}
7577

7678
function copyTopojsonFiles() {
77-
fs.copy(
78-
constants.pathToTopojsonSrc,
79-
constants.pathToTopojsonDist,
80-
{ clobber: true },
81-
common.throwOnError
82-
);
79+
fs.copy(constants.pathToTopojsonSrc, constants.pathToTopojsonDist, { clobber: true }, common.throwOnError);
8380
}

0 commit comments

Comments
 (0)