server/bundler/css-hot-reload.js
function onexit( code ) {
		let changedFiles;

		cssMake.stderr.removeListener( 'data', onstderr );
		cssMake.stdout.removeListener( 'data', onstdout );
		cssMake = null;

		if ( scheduleBuild ) {
			// Handle new css build request
			scheduleBuild = false;
			spawnMake();
		} else if ( 0 === code ) {
			// 'make build-css' success
			changedFiles = updateChangedCssFiles();
			if ( 0 !== changedFiles.length ) {
				debug( chalk.green( 'css reload' ) );
				io.of( '/css-hot-reload' ).emit( 'css-hot-reload', {
					status: 'reload',
					changedFiles: changedFiles,
				} );
			} else {
				debug( chalk.green( 'css up to date' ) );
				io.of( '/css-hot-reload' ).emit( 'css-hot-reload', { status: 'up-to-date' } );
			}
		} else {
			// 'make build-css' failed
			debug( chalk.red( 'css build failed' ) );
			io.of( '/css-hot-reload' ).emit( 'css-hot-reload', {
				status: 'build-failed',
				error: errors,
			} );
		}
	}
function onexit( code ) {
		let changedFiles;

		cssMake.stderr.removeListener( 'data', onstderr );
		cssMake.stdout.removeListener( 'data', onstdout );
		cssMake = null;

		if ( scheduleBuild ) {
			// Handle new css build request
			scheduleBuild = false;
			spawnMake();
		} else if ( 0 === code ) {
			// 'make build-css' success
			changedFiles = updateChangedCssFiles();
			if ( 0 !== changedFiles.length ) {
				debug( chalk.green( 'css reload' ) );
				io.of( '/css-hot-reload' ).emit( 'css-hot-reload', {
					status: 'reload',
					changedFiles: changedFiles,
				} );
			} else {
				debug( chalk.green( 'css up to date' ) );
				io.of( '/css-hot-reload' ).emit( 'css-hot-reload', { status: 'up-to-date' } );
			}
		} else {
			// 'make build-css' failed
			debug( chalk.red( 'css build failed' ) );
			io.of( '/css-hot-reload' ).emit( 'css-hot-reload', {
				status: 'build-failed',
				error: errors,
			} );
		}
	}
function onexit ( code ) { let changedFiles ; cssMake . stderr . removeListener ( 'data' , onstderr ) ; cssMake . stdout . removeListener ( 'data' , onstdout ) ; cssMake = null ; if ( scheduleBuild ) { // Handle new css build request scheduleBuild = false ; spawnMake ( ) ; } else if ( 0 === code ) { // 'make build-css' success changedFiles = updateChangedCssFiles ( ) ; if ( 0 !== changedFiles . length ) { debug ( chalk . green ( 'css reload' ) ) ; io . of ( '/css-hot-reload' ) . emit ( 'css-hot-reload' , { status : 'reload' , changedFiles : changedFiles , } ) ; } else { debug ( chalk . green ( 'css up to date' ) ) ; io . of ( '/css-hot-reload' ) . emit ( 'css-hot-reload' , { status : 'up-to-date' } ) ; } } else { // 'make build-css' failed debug ( chalk . red ( 'css build failed' ) ) ; io . of ( '/css-hot-reload' ) . emit ( 'css-hot-reload' , { status : 'build-failed' , error : errors , } ) ; } }
Handle 'make build-css' success or failure
@param {Number} code The exit code
Handle make build - css success or failure