@@ -2,14 +2,15 @@ import {spawn} from 'child_process';
2
2
import { existsSync , statSync , writeFileSync , readFileSync } from 'fs-extra' ;
3
3
import { join , basename } from 'path' ;
4
4
import { task , src , dest } from 'gulp' ;
5
- import { execTask , sequenceTask } from '../util/task_helpers' ;
5
+ import { execNodeTask , execTask , sequenceTask } from '../util/task_helpers' ;
6
6
import {
7
7
DIST_RELEASE , DIST_BUNDLES , DIST_MATERIAL , COMPONENTS_DIR , LICENSE_BANNER , DIST_ROOT
8
8
} from '../constants' ;
9
9
import * as minimist from 'minimist' ;
10
10
11
11
// There are no type definitions available for these imports.
12
12
const glob = require ( 'glob' ) ;
13
+ const gulpRename = require ( 'gulp-rename' ) ;
13
14
14
15
/** Parse command-line arguments for release task. */
15
16
const argv = minimist ( process . argv . slice ( 3 ) ) ;
@@ -23,14 +24,23 @@ const umdGlob = join(DIST_BUNDLES, '*.umd.*');
23
24
// Matches all flat ESM bundles (e.g material.js and material.es5.js)
24
25
const fesmGlob = [ join ( DIST_BUNDLES , '*.js' ) , `!${ umdGlob } ` ] ;
25
26
27
+ // The entry-point for the scss theming bundle.
28
+ const themingEntryPointPath = join ( COMPONENTS_DIR , 'core' , 'theming' , '_all-theme.scss' ) ;
29
+
30
+ // Output path for the scss theming bundle.
31
+ const themingBundlePath = join ( DIST_RELEASE , '_theming.scss' ) ;
32
+
33
+ // Matches all pre-built theme css files
34
+ const prebuiltThemeGlob = join ( DIST_MATERIAL , '**/theming/prebuilt/*.css' ) ;
35
+
26
36
task ( 'build:release' , sequenceTask (
27
37
'library:build' ,
28
38
':package:release' ,
29
39
) ) ;
30
40
31
41
/** Task that combines intermediate build artifacts into the release package structure. */
32
42
task ( ':package:release' , sequenceTask (
33
- [ ':package:typings' , ':package:umd' , ':package:fesm' , ':package:assets' ] ,
43
+ [ ':package:typings' , ':package:umd' , ':package:fesm' , ':package:assets' , ':package:theming' ] ,
34
44
':inline-metadata-resources' ,
35
45
':package:metadata' ,
36
46
) ) ;
@@ -80,6 +90,20 @@ task(':package:umd', () => src(umdGlob).pipe((dest(join(DIST_RELEASE, 'bundles')
80
90
/** Copy primary entry-point FESM bundles to the @angular/ directory. */
81
91
task ( ':package:fesm' , ( ) => src ( fesmGlob ) . pipe ( dest ( join ( DIST_RELEASE , '@angular' ) ) ) ) ;
82
92
93
+ /** Copies all prebuilt themes into the release package under `prebuilt-themes/` */
94
+ task ( ':package:theming' , [ ':bundle:theming-scss' ] ,
95
+ ( ) => src ( prebuiltThemeGlob )
96
+ . pipe ( gulpRename ( { dirname : '' } ) )
97
+ . pipe ( dest ( join ( DIST_RELEASE , 'prebuilt-themes' ) ) ) ) ;
98
+
99
+ /** Bundles all scss requires for theming into a single scss file in the root of the package. */
100
+ task ( ':bundle:theming-scss' , execNodeTask (
101
+ 'scss-bundle' ,
102
+ 'scss-bundle' , [
103
+ '-e' , themingEntryPointPath ,
104
+ '-d' , themingBundlePath ,
105
+ ] ) ) ;
106
+
83
107
/** Make sure we're logged in. */
84
108
task ( ':publish:whoami' , execTask ( 'npm' , [ 'whoami' ] , {
85
109
silent : true ,
0 commit comments