Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
bc7c0da
feat(core-styles): wip fp-1499 serve ui-patterns
wesleyboar Jul 10, 2022
2613891
feat(core-styles): wip fp-1499 build:ui…→copy:demo
wesleyboar Jul 10, 2022
f2fc9be
Merge branch 'main' into task/fp-1499-cms-pattern-library
wesleyboar Jul 10, 2022
22f3f0d
feat(core-styles): fp-1499 working demo
wesleyboar Jul 10, 2022
d191468
fix(core-styles): fp-1499 coreStylesRoot path
wesleyboar Jul 11, 2022
b62e9f8
feat(core-styles): fp-1499 no internal symlink
wesleyboar Jul 11, 2022
94a6a3c
feat(ui): fp-1499 inject cms styles, add colors
wesleyboar Jul 11, 2022
88900d9
chore(ui): fp-1499 remove redundant skin config
wesleyboar Jul 12, 2022
f3565b1
fix(ui): fp-1499 add dependencies explicitely
wesleyboar Jul 12, 2022
d031796
Merge branch 'main' into task/fp-1499-cms-pattern-library
wesleyboar Jul 12, 2022
2a5ccda
feat(css): fp-1499 extract getPath to get-path.js
wesleyboar Jul 12, 2022
ba53ede
feat(ui): build for --project, new context styles
wesleyboar Jul 12, 2022
f2829f2
chore(core-styles): fp-1499 rename fractal theme
wesleyboar Jul 12, 2022
d5d4a33
fix(core-styles): fp-1499/tup-308 site button css
wesleyboar Jul 12, 2022
a6bb5d1
feat(core-styles): fp-1499 fractal style load opts
wesleyboar Jul 12, 2022
d01e064
wip(core-styles): fp-1499 fractal custom build
wesleyboar Jul 12, 2022
898223d
Merge branch 'main' into task/fp-1499-cms-pattern-library
wesleyboar Jul 15, 2022
6da6414
Revert "wip(core-styles): fp-1499 fractal custom build"
wesleyboar Jul 15, 2022
db34044
chore(core-styles): project css path in only 1 spot
wesleyboar Jul 15, 2022
6c9d749
feat(core-styles): log fractal using project CSS
wesleyboar Jul 15, 2022
c4e4829
docs(ui): add build instructions to readme
wesleyboar Jul 15, 2022
55f24d0
Merge branch 'main' into task/fp-1499-cms-pattern-library
wesleyboar Jul 17, 2022
4a53ef0
docs(readme): ui pattern library → ui pattern demo
wesleyboar Jul 17, 2022
9708a58
fix(package): undo description change
wesleyboar Jul 17, 2022
e141da8
chore(bin): build css, remove new overcomplication
wesleyboar Jul 17, 2022
8b8876e
feat(ui): lint config file (manually)
wesleyboar Jul 17, 2022
8ff3185
chore(ui): polish config file
wesleyboar Jul 17, 2022
0e841bf
fix(ui): skip base component css because site.css
wesleyboar Jul 18, 2022
8edb904
chore(core-styles): load 0.7.0 (not gitpkg.now.sh)
wesleyboar Jul 18, 2022
23d43d7
docs(readme): polish core-styles local dev steps
wesleyboar Jul 18, 2022
6bdd432
Merge branch 'main' into task/fp-1499-cms-pattern-library
wesleyboar Jul 18, 2022
b44fef1
fix(ui): install core-styles 0.8.0-beta
wesleyboar Jul 18, 2022
05409b4
Merge branch 'main' into task/fp-1499-cms-pattern-library
wesleyboar Jul 23, 2022
e06cb04
chore(ui): install core-styles at branch
wesleyboar Jul 23, 2022
5bc9a24
Merge branch 'main' into task/fp-1499-cms-pattern-library
wesleyboar Jul 25, 2022
d49b2d2
chore(taccsite_ui): core-styles@0.8.0-beta
wesleyboar Jul 25, 2022
c1734bb
docs: test/dev core styles + cms, link to wiki
wesleyboar Jul 25, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ repo_name.var
/static
/media

# UI Pattern Demo
/taccsite_ui

# Secrets and Customizations
taccsite_cms/secrets.py
*.custom.yml
Expand Down
28 changes: 15 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,20 @@ If you need to change files within `/taccsite_custom`:
<sub>† See [Restarting the CMS Server](#restarting-the-cms-server).</sub>


### UI Pattern Demo

This demo shows [Core Styles] with `site.css` from either [Core CMS] or a [Core CMS Resources] project.

1. Build UI patterns demo: \*†

```bash
npm run build:demo --project=name-of-project
```

<sub>\* You should run these commands in the container __from `/code/`__. _See [Running Commands in Container](#running-commands-in-container)._</sub>\
<sub>† Where `name-of-project` is "core-cms" or matches a directory from `/taccsite_custom`. __A project name is required.__</sub>


## Running Commands in Container

__If using `docker-compose.yml` then__ run certain commands via shell within container (because files are __not__ re-synced with local machine).
Expand Down Expand Up @@ -341,19 +355,7 @@ We use a modifed version of [GitFlow](https://datasift.github.io/gitflow/Introdu

#### Testing Core Styles Changes Locally

1. Clone [Core Styles] (if you haven't already).
2. Tell project to temporarily use your [Core Styles] clone:
```bash
npx link path-to/core-styles # e.g. npx link ../tup-ui/libs/core-styles
```

3. Make changes in your [Core Styles] clone as necessary.
4. [Build static files.](#how-to-build-static-files)
5. Test changes.
6. Commit successful changes to a [Core Styles] branch.

> __Notice__: [If you run `npm install` or `npm ci`, the link is destroyed.](https://github.com/npm/cli/issues/2380#issuecomment-1029967927) Repeat the `… link …` step to restore it.

See [Locally Develop CMS and Styles](https://github.com/TACC/Core-CMS/wiki/Locally-Develop-CMS-and-Styles).

### Best Practices

Expand Down
24 changes: 12 additions & 12 deletions bin/build-css.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ const fs = require('fs');
const buildStylesheets = require('@tacc/core-styles').buildStylesheets;
const mininmist = require('minimist');

const { getSourcePath } = require( __dirname + '/../bin/get-path.js');

const ROOT = __dirname + '/..';
const CORE_NAME = 'core-cms';
const ARGS = mininmist( process.argv.slice( 2 ) );
Expand All @@ -16,8 +18,16 @@ const BUILD_ID = ARGS['build-id'] || '';
/** Build stylesheets for Core and (optional) project */
(() => {
// Get style paths
const corePath = _getPath('taccsite_cms', 'site_cms');
const projPath = _getPath(`taccsite_custom/${PROJECT_NAME}`, PROJECT_NAME );
const corePath = getSourcePath(
'taccsite_cms',
'site_cms',
'css'
);
const projPath = getSourcePath(
'taccsite_custom/' + PROJECT_NAME,
PROJECT_NAME,
'css'
);
const hasProject = ( PROJECT_NAME && PROJECT_NAME !== CORE_NAME );

// Get config paths
Expand Down Expand Up @@ -59,13 +69,3 @@ function _build( name, path, configs, id ) {
}
);
}

/**
* Get path to CSS resources
* @param {string} dirName - The name of the directory
* @param {string} [subDirName=dirName] - The name of the sub-directory
* @return {string}
*/
function _getPath( dirName, subDirName ) {
return dirName + '/static/' + ( subDirName || dirName ) + '/css';
}
29 changes: 29 additions & 0 deletions bin/get-path.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env node

/** Get paths to core or project assets */

const path = require('path');

/**
* Get path to source file
* @param {string} dirName - The name of the project directory
* @param {string} [appName=dirName] - The name of the app directory
* @param {string} [end] - Any thing to append to the path
* @return {string}
*/
function getSourcePath( dirName, appName, end ) {
const subDirName = appName || dirName;
return path.join( dirName, 'static', subDirName, end );
}

/**
* Get Django static file path
* @param {string} appName - The name of the app directory
* @param {string} [end] - Any thing to append to the path
* @return {string}
*/
function getStaticFilePath( appName, end ) {
return path.join( 'static', appName, end );
}

module.exports = { getSourcePath, getStaticFilePath };
65 changes: 65 additions & 0 deletions fractal.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
'use strict';

const path = require('path');
const mandelbrot = require('@frctl/mandelbrot');
const minimist = require('minimist');

// Get base config
const fractal = require('@tacc/core-styles/fractal.config.js');
const themeConfig = require('@tacc/core-styles/fractal.theme.js');

// Get project
// (name)
const { getStaticFilePath } = require( __dirname + '/bin/get-path.js');
const args = minimist( process.argv.slice( 2 ));
let projectName = args['project'] || '';
projectName = ( projectName !== 'core-cms' ) ? projectName : '';
// (stylesheet)
const projectCSSFile = projectName
? path.join( '/', getStaticFilePath( projectName, 'css/build/site.css'))
: null;

// Get base path
const coreStylesRoot = path.join(
path.dirname( require.resolve('@tacc/core-styles')),
// The '../' exits 'src/' which is at the end of what require.resolve returns
'../'
);

// Set source paths
// (for components)
fractal.components.set('path',
path.join( coreStylesRoot, 'src/lib/_imports')
);
// (for stylesheets)
fractal.components.set('default.context', {
styles: {
shouldSkipBase: true, // true, because site.css includes components
external: {
global: [
'https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css',
'/static/site_cms/css/build/site.css'
].concat(
( projectCSSFile ) ? [ projectCSSFile ] : []
)
}
}
});
if ( projectCSSFile ) {
fractal.cli.log(`+ Included CSS for "${projectName}": '${projectCSSFile}'`);
}

// Set website paths
fractal.web.set('static.path', path.join( coreStylesRoot, 'dist'));
fractal.web.set('builder.dest', __dirname + '/taccsite_ui');

// Customize theme
const theme = mandelbrot( Object.assign( themeConfig, {
skin: Object.assign( themeConfig.skin, {
links: '#877453',
})
}));
fractal.web.theme( theme );

// Export
module.exports = fractal;
Loading