Created
November 7, 2016 09:56
-
-
Save 0x6a68/eea66b4a57ad107f9b466fba2b052ae0 to your computer and use it in GitHub Desktop.
fractal programmatically
This file contains hidden or 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
const fractal = require('@frctl/fractal').create() | |
require('./setup')(fractal) | |
const server = require('./server')(fractal, { | |
port: 4000, | |
sync: true, | |
watch: true, | |
syncOptions: { | |
files: [ | |
'files-i-want-to-watch-also.css', | |
], | |
}, | |
}) | |
server.start() |
This file contains hidden or 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
module.exports = (fractal, options = {}) => { | |
const server = fractal.web.server(options) | |
return { | |
start: () => server.start().then(() => { | |
console.log(`Fractal server is now running at ${server.url}`) | |
}), | |
stop: () => server.stop(), | |
} | |
} |
This file contains hidden or 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
const reactAdapter = require('./react-adapter') | |
const path = require('path') | |
const BASE_DIR = process.cwd() | |
module.exports = (fractal) => { | |
fractal.set('project.title', 'bam!') | |
fractal.components.engine(reactAdapter) | |
fractal.components.set('path', `${BASE_DIR}/src/components`) | |
fractal.components.set('default.status', 'prototype') | |
fractal.components.set('default.preview', '@preview') | |
fractal.components.set('ext', '.js') | |
fractal.docs.set('path', path.join(process.cwd(), BASE_DIR, 'docs')) | |
fractal.web.set('static.path', path.join(BASE_DIR, 'public')) | |
fractal.web.set('build.dest', path.join(BASE_DIR, 'build')) | |
} |
Author
0x6a68
commented
Nov 7, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment