Skip to content

Commit 5f360f9

Browse files
authored
build: package theming files into release output (#3776)
1 parent de21d9e commit 5f360f9

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@
102102
"rollup": "^0.41.6",
103103
"run-sequence": "^1.2.2",
104104
"sass": "^0.5.0",
105+
"scss-bundle": "^1.0.1",
105106
"selenium-webdriver": "^3.1.0",
106107
"stylelint": "^7.8.0",
107108
"travis-after-modes": "0.0.7",

tools/gulp/tasks/release.ts

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@ import {spawn} from 'child_process';
22
import {existsSync, statSync, writeFileSync, readFileSync} from 'fs-extra';
33
import {join, basename} from 'path';
44
import {task, src, dest} from 'gulp';
5-
import {execTask, sequenceTask} from '../util/task_helpers';
5+
import {execNodeTask, execTask, sequenceTask} from '../util/task_helpers';
66
import {
77
DIST_RELEASE, DIST_BUNDLES, DIST_MATERIAL, COMPONENTS_DIR, LICENSE_BANNER, DIST_ROOT
88
} from '../constants';
99
import * as minimist from 'minimist';
1010

1111
// There are no type definitions available for these imports.
1212
const glob = require('glob');
13+
const gulpRename = require('gulp-rename');
1314

1415
/** Parse command-line arguments for release task. */
1516
const 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)
2425
const 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+
2636
task('build:release', sequenceTask(
2737
'library:build',
2838
':package:release',
2939
));
3040

3141
/** Task that combines intermediate build artifacts into the release package structure. */
3242
task(':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. */
8191
task(':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. */
84108
task(':publish:whoami', execTask('npm', ['whoami'], {
85109
silent: true,

0 commit comments

Comments
 (0)