1
1
import { spawn } from 'child_process' ;
2
- import { existsSync , readFileSync , statSync , writeFileSync } from 'fs-extra' ;
3
- import { basename , join } from 'path' ;
2
+ import { existsSync , statSync , writeFileSync } from 'fs-extra' ;
3
+ import { join } from 'path' ;
4
4
import { dest , src , task } from 'gulp' ;
5
- import { inlineMetadataResources } from '../util/inline-resources' ;
6
- import { execNodeTask , execTask , sequenceTask } from '../util/task_helpers' ;
5
+ import { execTask , sequenceTask } from '../util/task_helpers' ;
7
6
import { composeRelease } from '../util/package-build' ;
7
+ import { Bundler } from 'scss-bundle' ;
8
8
import {
9
9
COMPONENTS_DIR ,
10
- DIST_BUNDLES ,
11
10
DIST_MATERIAL ,
12
11
DIST_RELEASES ,
13
- DIST_ROOT ,
14
- LICENSE_BANNER ,
15
- PROJECT_ROOT ,
16
12
} from '../constants' ;
17
13
import * as minimist from 'minimist' ;
18
14
19
15
// There are no type definitions available for these imports.
20
- const glob = require ( 'glob' ) ;
21
16
const gulpRename = require ( 'gulp-rename' ) ;
22
17
23
18
/** Parse command-line arguments for release task. */
@@ -32,6 +27,9 @@ const themingEntryPointPath = join(COMPONENTS_DIR, 'core', 'theming', '_all-them
32
27
// Output path for the scss theming bundle.
33
28
const themingBundlePath = join ( releasePath , '_theming.scss' ) ;
34
29
30
+ // Matches all SCSS files in the library.
31
+ const allScssGlob = join ( COMPONENTS_DIR , '**/*.scss' ) ;
32
+
35
33
// Matches all pre-built theme css files
36
34
const prebuiltThemeGlob = join ( DIST_MATERIAL , '**/theming/prebuilt/*.css' ) ;
37
35
@@ -51,27 +49,21 @@ task(':package:theming', [':bundle:theming-scss'], () => {
51
49
} ) ;
52
50
53
51
/** Bundles all scss requires for theming into a single scss file in the root of the package. */
54
- task ( ':bundle:theming-scss' , execNodeTask (
55
- 'scss-bundle' ,
56
- 'scss-bundle' , [
57
- '-e' , themingEntryPointPath ,
58
- '-d' , themingBundlePath
59
- ] , { silentStdout : true }
60
- ) ) ;
52
+ task ( ':bundle:theming-scss' , ( ) => {
53
+ // Instantiates the SCSS bundler and bundles all imports of the specified entry point SCSS file.
54
+ // A glob of all SCSS files in the library will be passed to the bundler. The bundler takes an
55
+ // array of globs, which will match SCSS files that will be only included once in the bundle.
56
+ new Bundler ( ) . Bundle ( themingEntryPointPath , [ allScssGlob ] ) . then ( result => {
57
+ writeFileSync ( themingBundlePath , result . bundledContent ) ;
58
+ } ) ;
59
+ } ) ;
61
60
62
61
/** Make sure we're logged in. */
63
62
task ( ':publish:whoami' , execTask ( 'npm' , [ 'whoami' ] , {
64
63
silent : true ,
65
64
errMessage : 'You must be logged in to publish.'
66
65
} ) ) ;
67
66
68
- /** Create a typing file that links to the bundled definitions of NGC. */
69
- function createTypingFile ( ) {
70
- writeFileSync ( join ( releasePath , 'material.d.ts' ) ,
71
- LICENSE_BANNER + '\nexport * from "./typings/index";'
72
- ) ;
73
- }
74
-
75
67
task ( ':publish:logout' , execTask ( 'npm' , [ 'logout' ] ) ) ;
76
68
77
69
0 commit comments