Skip to content

Commit

Permalink
wip(core-styles): fp-1499 fractal custom build
Browse files Browse the repository at this point in the history
Status (Fail):
```
Core-CMS git:(task/fp-1499-cms-pattern-library) ✗ npm run build:demo

> @TACC/core-cms@3.7.11 build:demo
> fractal build-project $npm_config_project

Warning: command named "info" was registered more than once.
If you intend to override a command, you should explicitly remove the first command with command.remove().
[...]
```
  • Loading branch information
wesleyboar committed Jul 12, 2022
1 parent a6bb5d1 commit d01e064
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 12 deletions.
40 changes: 29 additions & 11 deletions fractal.config.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
'use strict';

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

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

const args = minimist( process.argv.slice( 2 ) );
let projectName = args['project'] || '';
projectName = ( projectName !== 'core-cms' ) ? projectName : '';
const projectCSSFile = projectName
? getStaticFilePath( projectName, 'css/build/site.css')
: null;

const fractal = require('@tacc/core-styles/fractal.config.js');
const themeConfig = require('@tacc/core-styles/fractal.theme.js');
Expand All @@ -38,13 +30,39 @@ fractal.components.set('default.context', {
global: [
'https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css',
'/static/site_cms/css/build/site.css'
].concat(
( projectCSSFile ) ? [ '/' + projectCSSFile ] : []
)
]
}
}
});



fractal.cli.command(
'build-project [project]',
function buildProject( args, done ) {
// The Core site is named 'core-cms', but its Python app name is 'site_cms'
const coreName = 'site_cms';
let projName = args.project || coreName;
projName = ( projName === 'core-cms' ) ? coreName : projName;

const context = this.fractal.components.get('default.context');
const projCSSFile = getStaticFilePath( projName, 'css/build/site.css');

if ( projName ) {
context.styles.external.global.push( projCSSFile );
}
this.fractal.components.set('default.context', context);

this.fractal.cli.exec('build');

done();
}, {
description: 'Lists components in the project'
}
);



fractal.web.set('static.path',
path.join(coreStylesRoot, 'dist')
);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"scripts": {
"build": "npm run build:css && npm run build:demo",
"build:css": "bin/build-css.js --project=$npm_config_project --build-id=$npm_config_build_id",
"build:demo": "fractal build --project=$npm_config_project"
"build:demo": "fractal build-project $npm_config_project"
},
"homepage": "https://github.com/TACC/Core-CMS"
}

0 comments on commit d01e064

Please sign in to comment.