@@ -2,14 +2,15 @@ import {spawn} from 'child_process';
22import { existsSync , statSync , writeFileSync , readFileSync } from 'fs-extra' ;
33import { join , basename } from 'path' ;
44import { task , src , dest } from 'gulp' ;
5- import { execTask , sequenceTask } from '../util/task_helpers' ;
5+ import { execNodeTask , execTask , sequenceTask } from '../util/task_helpers' ;
66import {
77 DIST_RELEASE , DIST_BUNDLES , DIST_MATERIAL , COMPONENTS_DIR , LICENSE_BANNER , DIST_ROOT
88} from '../constants' ;
99import * as minimist from 'minimist' ;
1010
1111// There are no type definitions available for these imports.
1212const glob = require ( 'glob' ) ;
13+ const gulpRename = require ( 'gulp-rename' ) ;
1314
1415/** Parse command-line arguments for release task. */
1516const argv = minimist ( process . argv . slice ( 3 ) ) ;
@@ -23,14 +24,23 @@ const umdGlob = join(DIST_BUNDLES, '*.umd.*');
2324// Matches all flat ESM bundles (e.g material.js and material.es5.js)
2425const fesmGlob = [ join ( DIST_BUNDLES , '*.js' ) , `!${ umdGlob } ` ] ;
2526
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+
2636task ( 'build:release' , sequenceTask (
2737 'library:build' ,
2838 ':package:release' ,
2939) ) ;
3040
3141/** Task that combines intermediate build artifacts into the release package structure. */
3242task ( ':package:release' , sequenceTask (
33- [ ':package:typings' , ':package:umd' , ':package:fesm' , ':package:assets' ] ,
43+ [ ':package:typings' , ':package:umd' , ':package:fesm' , ':package:assets' , ':package:theming' ] ,
3444 ':inline-metadata-resources' ,
3545 ':package:metadata' ,
3646) ) ;
@@ -80,6 +90,20 @@ task(':package:umd', () => src(umdGlob).pipe((dest(join(DIST_RELEASE, 'bundles')
8090/** Copy primary entry-point FESM bundles to the @angular/ directory. */
8191task ( ':package:fesm' , ( ) => src ( fesmGlob ) . pipe ( dest ( join ( DIST_RELEASE , '@angular' ) ) ) ) ;
8292
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+
83107/** Make sure we're logged in. */
84108task ( ':publish:whoami' , execTask ( 'npm' , [ 'whoami' ] , {
85109 silent : true ,
0 commit comments