-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: 🎸 migrates pattern library from Pattern Lab to Fractal
affects: @buildit/gravity-ui-nunjucks
- Loading branch information
Showing
361 changed files
with
13,546 additions
and
12,087 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
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,51 @@ | ||
const fractal = require('@frctl/fractal').create(); | ||
const nunj = require('@frctl/nunjucks'); | ||
|
||
const bldApi = require('./build-api'); | ||
const bldPaths = require('./gulp/paths'); | ||
|
||
/* Set the title of the project */ | ||
fractal.set('project.title', 'Build Gravity pattern library'); | ||
fractal.set('project.version', bldApi.version); | ||
|
||
|
||
/* Tell Fractal where the components will live */ | ||
fractal.components.set('path', bldPaths.srcComponentsPath()); | ||
|
||
// register the Nunjucks adapter for your components | ||
fractal.components.engine(nunj()); | ||
|
||
// look for files with a .nunj file extension | ||
fractal.components.set('ext', '.njk'); | ||
|
||
|
||
/* Tell Fractal where the documentation pages will live */ | ||
fractal.docs.set('path', bldPaths.srcDocsPath()); | ||
|
||
// Set engine to Nunjucks | ||
fractal.docs.engine(nunj); | ||
fractal.docs.set('ext', '.md'); | ||
|
||
|
||
/* Tell Fractal which directory to serve up for static assets */ | ||
fractal.web.set('static.path', bldPaths.distAssetsPath()); | ||
|
||
/* Tell Fractal which directory to build static HTML output to */ | ||
fractal.web.set('builder.dest', bldApi.distPatternLibraryPath()); | ||
|
||
/* Tweak BrowserSync config */ | ||
// fractal.web.set('server.syncOptions', { | ||
// snippetOptions: { | ||
// // Make BrowerSync JS snippet get appended | ||
// // to <head> instead of <body>, so that it doesn't | ||
// // interfere with our * + * CSS rules. | ||
// rule: { | ||
// fn(snippet, match) { | ||
// return snippet + match; | ||
// }, | ||
// match: /<\/head>/i, | ||
// }, | ||
// }, | ||
// }); | ||
|
||
module.exports = fractal; |
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,61 @@ | ||
const fractal = require('../fractal'); | ||
|
||
const taskNamePrefix = 'fractal:'; | ||
|
||
// keep a reference to the fractal CLI console utility | ||
const logger = fractal.cli.console; | ||
|
||
/* | ||
* Start the Fractal server | ||
* | ||
* In this example we are passing the option 'sync: true' which means that it will | ||
* use BrowserSync to watch for changes to the filesystem and refresh the browser automatically. | ||
* Obviously this is completely optional! | ||
* | ||
* This task will also log any errors to the console. | ||
*/ | ||
async function startServer() { | ||
const server = fractal.web.server({ | ||
sync: true, | ||
}); | ||
|
||
server.on('error', (err) => { | ||
return logger.error(err.message); | ||
}); | ||
|
||
await server.start(); | ||
logger.success(`Fractal server is now running at ${server.url}`); | ||
logger.success(`Network URL: ${server.urls.sync.external}`); | ||
} | ||
startServer.displayName = `${taskNamePrefix}start`; | ||
|
||
|
||
/* | ||
* Run a static export of the project web UI. | ||
* | ||
* This task will report on progress using the 'progress' event emitted by the | ||
* builder instance, and log any errors to the terminal. | ||
* | ||
* The build destination will be the directory specified in the 'builder.dest' | ||
* configuration option set above. | ||
*/ | ||
async function buildPatternLibrary() { | ||
const builder = fractal.web.builder(); | ||
|
||
builder.on('progress', (completed, total) => { | ||
return logger.update(`Exported ${completed} of ${total} items`, 'info'); | ||
}); | ||
builder.on('error', (err) => { | ||
return logger.error(err.message); | ||
}); | ||
|
||
await builder.build(); | ||
logger.success('Fractal build completed!'); | ||
} | ||
buildPatternLibrary.displayName = `${taskNamePrefix}build`; | ||
|
||
|
||
module.exports = { | ||
startServer, | ||
buildPatternLibrary | ||
} |
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
Oops, something went wrong.