Skip to content

Commit

Permalink
build: silent sass bundling (#3784)
Browse files Browse the repository at this point in the history
* No longer prints the whole SASS file-tree when running the `build:release` task.
* Added a new options that allows disabling STDOUT messages. STDERR is important for error messages.
  • Loading branch information
devversion authored and tinayuangao committed Mar 31, 2017
1 parent 2240b6c commit a225b77
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
9 changes: 4 additions & 5 deletions tools/gulp/tasks/release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,10 @@ task(':package:theming', [':bundle:theming-scss'],

/** Bundles all scss requires for theming into a single scss file in the root of the package. */
task(':bundle:theming-scss', execNodeTask(
'scss-bundle',
'scss-bundle', [
'-e', themingEntryPointPath,
'-d', themingBundlePath,
]));
'scss-bundle', 'scss-bundle', ['-e', themingEntryPointPath, '-d', themingBundlePath], {
silentStdout: true
}
));

/** Make sure we're logged in. */
task(':publish:whoami', execTask('npm', ['whoami'], {
Expand Down
16 changes: 8 additions & 8 deletions tools/gulp/util/task_helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,10 @@ export function sassBuildTask(dest: string, root: string, minify = false) {

/** Options that can be passed to execTask or execNodeTask. */
export interface ExecTaskOptions {
// Whether to output to STDERR and STDOUT.
// Whether STDOUT and STDERR messages should be printed.
silent?: boolean;
// Whether STDOUT messages should be printed.
silentStdout?: boolean;
// If an error happens, this will replace the standard error.
errMessage?: string;
}
Expand All @@ -65,14 +67,12 @@ export function execTask(binPath: string, args: string[], options: ExecTaskOptio
return (done: (err?: string) => void) => {
const childProcess = child_process.spawn(binPath, args);

if (!options.silent) {
childProcess.stdout.on('data', (data: string) => {
process.stdout.write(data);
});
if (!options.silentStdout && !options.silent) {
childProcess.stdout.on('data', (data: string) => process.stdout.write(data));
}

childProcess.stderr.on('data', (data: string) => {
process.stderr.write(data);
});
if (!options.silent) {
childProcess.stderr.on('data', (data: string) => process.stderr.write(data));
}

childProcess.on('close', (code: number) => {
Expand Down

1 comment on commit a225b77

@DovydasNavickas
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've updated scss-bundle CLI to include --verbosity level.
reactway/scss-bundle#10 (comment)
You can control it via CLI instead of routing the output differently. Also, we will create the gulp wrapper for easier gulp consumption later on.

Please sign in to comment.