-
-
Notifications
You must be signed in to change notification settings - Fork 486
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* make the .bootstraprc location customizable * Fixes handling of default configuration when there's neither a custom bootstraprc location nor a user supplied .bootstraprc. * More logging * Configured the css modules example to use either a fixed file or a specified location. * Made the shorter script names be the ones that use file location as that is better for testing the examples, as changes to the .bootstraprc file get overwritten.
- Loading branch information
Showing
35 changed files
with
384 additions
and
241 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file was deleted.
Oops, something went wrong.
Empty file.
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
'use strict'; | ||
const fs = require('fs'); | ||
|
||
function getBootstraprcCustomLocation() { | ||
const matchedArgument = process.argv.find(val => val.includes('--bootstraprc-location')); | ||
return matchedArgument && matchedArgument.split('=')[1]; | ||
} | ||
|
||
const bootstraprcCustomLocation = getBootstraprcCustomLocation(); | ||
|
||
let defaultBootstraprcFileExists; | ||
|
||
try { | ||
fs.statSync('./.bootstraprc'); | ||
defaultBootstraprcFileExists = true; | ||
} catch (e) { | ||
defaultBootstraprcFileExists = false; | ||
} | ||
|
||
if (!bootstraprcCustomLocation && !defaultBootstraprcFileExists) { | ||
/* eslint no-console: 0 */ | ||
console.log('You did not specify a \'bootstraprc-location\' arg or a ./.boostraprc file in the root.'); | ||
console.log('Using the bootstrap-loader default configuration.'); | ||
} | ||
|
||
// DEV and PROD have slightly different configurations | ||
let bootstrapDevEntryPoint; | ||
if (bootstraprcCustomLocation) { | ||
bootstrapDevEntryPoint = 'bootstrap-loader/lib/bootstrap.loader?' + | ||
`configFilePath=${__dirname}/${bootstraprcCustomLocation}` + | ||
'!bootstrap-loader/no-op.js'; | ||
} else { | ||
bootstrapDevEntryPoint = 'bootstrap-loader'; | ||
} | ||
|
||
let bootstrapProdEntryPoint; | ||
if (bootstraprcCustomLocation) { | ||
bootstrapProdEntryPoint = 'bootstrap-loader/lib/bootstrap.loader?extractStyles' + | ||
`&configFilePath=${__dirname}/${bootstraprcCustomLocation}` + | ||
'!bootstrap-loader/no-op.js'; | ||
} else { | ||
bootstrapProdEntryPoint = 'bootstrap-loader/extractStyles'; | ||
} | ||
|
||
module.exports = { | ||
dev: bootstrapDevEntryPoint, | ||
prod: bootstrapProdEntryPoint, | ||
}; |
Oops, something went wrong.