-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Core-Styles: Fix Themes / .postcssrc-Merge Support
- Loading branch information
1 parent
6cb0143
commit f2986e2
Showing
8 changed files
with
79 additions
and
23 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,48 @@ | ||
#!/usr/bin/env node | ||
|
||
const cmd = require('node-cmd'); | ||
const projectName = process.env.npm_config_project; | ||
|
||
const ROOT = __dirname + '/../..'; | ||
const CORE_NAME = 'core-cms'; | ||
const PROJECT_NAME = process.env.npm_config_project || CORE_NAME; | ||
|
||
build('core-cms'); | ||
if ( projectName && projectName !== 'core-cms') { | ||
build( projectName ); | ||
} | ||
build(PROJECT_NAME); | ||
|
||
/** | ||
* Execute command to build CSS for given project (directory) | ||
* @param {string} projectName - The name of the project | ||
*/ | ||
function build( projectName ) { | ||
const path = projectName + '/static/' + projectName + '/css'; | ||
const corePath = getPath(CORE_NAME); | ||
const projectPath = getPath(projectName); | ||
|
||
cmd.runSync(` | ||
core-styles\ | ||
--input-dir "${ROOT}/${path}/src"\ | ||
--output-dir "${ROOT}/${path}/build"\ | ||
--input-dir "${ROOT}/${corePath}/src"\ | ||
--output-dir "${ROOT}/${corePath}/build"\ | ||
--custom-config-files\ | ||
"${ROOT}/_shared/.postcssrc.yml"\ | ||
"${ROOT}/${path}/src/.postcssrc.yml"\ | ||
"${ROOT}/${corePath}/.postcssrc.yml"\ | ||
--verbose\ | ||
`); | ||
|
||
if (corePath !== projectPath) { | ||
cmd.runSync(` | ||
core-styles\ | ||
--input-dir "${ROOT}/${projectPath}/src"\ | ||
--output-dir "${ROOT}/${projectPath}/build"\ | ||
--custom-config-files\ | ||
"${ROOT}/${corePath}/.postcssrc.yml"\ | ||
"${ROOT}/${projectPath}/.postcssrc.yml"\ | ||
--verbose\ | ||
`); | ||
} | ||
} | ||
|
||
/** | ||
* Get path to CSS resources | ||
* @param {string} dirName - The name of the directory | ||
* @return {string} - The path | ||
*/ | ||
function getPath( dirName ) { | ||
return dirName + '/static/' + dirName + '/css'; | ||
} |
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 |
---|---|---|
@@ -1,30 +1,50 @@ | ||
#!/usr/bin/env node | ||
|
||
const coreStyles = require('core-styles'); | ||
const projectName = process.env.npm_config_project; | ||
|
||
const ROOT = __dirname + '/../..'; | ||
const CORE_NAME = 'core-cms'; | ||
const PROJECT_NAME = process.env.npm_config_project || CORE_NAME; | ||
|
||
build('core-cms'); | ||
if ( projectName && projectName !== 'core-cms') { | ||
build( projectName ); | ||
} | ||
build(PROJECT_NAME); | ||
|
||
/** | ||
* Execute command to build CSS for given project (directory) | ||
* @param {string} projectName - The name of the project | ||
*/ | ||
function build( projectName ) { | ||
const path = projectName + '/static/' + projectName + '/css'; | ||
function build( projectName ) { | ||
const corePath = getPath(CORE_NAME); | ||
const projectPath = getPath(projectName); | ||
|
||
coreStyles( | ||
`${ROOT}/${path}/src`, | ||
`${ROOT}/${path}/build`, { | ||
`${ROOT}/${corePath}/src`, | ||
`${ROOT}/${corePath}/build`, { | ||
customConfigFiles: [ | ||
`${ROOT}/_shared/.postcssrc.yml`, | ||
`${ROOT}/${path}/src/.postcssrc.yml` | ||
`${ROOT}/${corePath}/.postcssrc.yml` | ||
], | ||
verbose: true, | ||
} | ||
); | ||
|
||
if (corePath !== projectPath) { | ||
coreStyles( | ||
`${ROOT}/${projectPath}/src`, | ||
`${ROOT}/${projectPath}/build`, { | ||
customConfigFiles: [ | ||
`${ROOT}/${corePath}/.postcssrc.yml`, | ||
`${ROOT}/${projectPath}/.postcssrc.yml` | ||
], | ||
verbose: true, | ||
} | ||
); | ||
} | ||
} | ||
|
||
/** | ||
* Get path to CSS resources | ||
* @param {string} dirName - The name of the directory | ||
* @return {string} - The path | ||
*/ | ||
function getPath( dirName ) { | ||
return dirName + '/static/' + dirName + '/css'; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
_shared/.postcssrc.yml → core-cms/static/core-cms/css/.postcssrc.yml
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Merged on top of Core-CMS-Resources base config | ||
# SEE: https://github.com/tacc-wbomar/Core-CMS-Resources/blob/test/core-styles/_shared/static/css/.postcssrc.base.yml | ||
plugins: | ||
postcss-env-function: | ||
importFrom: | ||
- 'node_modules/core-styles/source/_themes/has-dark-logo.json' |
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,7 @@ | ||
# Merged on top of Core-CMS-Resources base config | ||
# SEE: https://github.com/tacc-wbomar/Core-CMS-Resources/blob/test/core-styles/_shared/static/css/.postcssrc.base.yml | ||
plugins: | ||
postcss-env-function: | ||
importFrom: | ||
- 'node_modules/core-styles/source/_themes/default.json' | ||
# - 'node_modules/core-styles/source/_themes/blue-header.json' |
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