@@ -16,32 +16,25 @@ updateVersion(constants.pathToPlotlyVersion);
1616
1717// convert scss to css to js and static css file
1818function makeBuildCSS ( ) {
19- sass . render (
20- {
21- file : constants . pathToSCSS ,
22- outputStyle : 'compressed'
23- } ,
24- function ( err , result ) {
25- if ( err ) throw err ;
19+ sass . render ( {
20+ file : constants . pathToSCSS ,
21+ outputStyle : 'compressed'
22+ } , function ( err , result ) {
23+ if ( err ) throw err ;
2624
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- } ) ;
40-
41- // css to js to be inlined
42- pullCSS ( String ( result . css ) , constants . pathToCSSBuild ) ;
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 ] ) ;
4330 }
44- ) ;
31+ fs . writeFile ( constants . pathToCSSDist , staticCSS , function ( err ) {
32+ if ( err ) throw err ;
33+ } ) ;
34+
35+ // css to js to be inlined
36+ pullCSS ( String ( result . css ) , constants . pathToCSSBuild ) ;
37+ } ) ;
4538}
4639
4740function addAdditionalCSSRules ( staticStyleString , selector , style ) {
@@ -51,30 +44,40 @@ function addAdditionalCSSRules(staticStyleString, selector, style) {
5144function exposePartsInLib ( ) {
5245 var obj = { } ;
5346
54- var insert = function ( name , folder ) {
47+ var insert = function ( name , folder ) {
5548 obj [ name ] = folder + '/' + name ;
5649 } ;
5750
5851 insert ( 'core' , 'src' ) ;
5952
6053 insert ( 'calendars' , 'src/components' ) ;
6154
62- constants . allTraces . forEach ( function ( k ) {
55+ constants . allTraces . forEach ( function ( k ) {
6356 insert ( k , 'src/traces' ) ;
6457 } ) ;
6558
6659 writeLibFiles ( obj ) ;
6760}
6861
6962function writeLibFiles ( obj ) {
70- for ( var name in obj ) {
63+ for ( var name in obj ) {
7164 common . writeFile (
7265 path . join ( constants . pathToLib , name + '.js' ) ,
73- [ "'use strict';" , '' , "module.exports = require('../" + obj [ name ] + "');" , '' ] . join ( '\n' )
66+ [
67+ '\'use strict\';' ,
68+ '' ,
69+ 'module.exports = require(\'../' + obj [ name ] + '\');' ,
70+ ''
71+ ] . join ( '\n' )
7472 ) ;
7573 }
7674}
7775
7876function copyTopojsonFiles ( ) {
79- fs . copy ( constants . pathToTopojsonSrc , constants . pathToTopojsonDist , { clobber : true } , common . throwOnError ) ;
77+ fs . copy (
78+ constants . pathToTopojsonSrc ,
79+ constants . pathToTopojsonDist ,
80+ { clobber : true } ,
81+ common . throwOnError
82+ ) ;
8083}
0 commit comments