Skip to content

Instantly share code, notes, and snippets.

@0x6a68
Created November 7, 2016 09:56
Show Gist options
  • Save 0x6a68/eea66b4a57ad107f9b466fba2b052ae0 to your computer and use it in GitHub Desktop.
Save 0x6a68/eea66b4a57ad107f9b466fba2b052ae0 to your computer and use it in GitHub Desktop.
fractal programmatically
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()
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(),
}
}
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'))
}
@0x6a68
Copy link
Author

0x6a68 commented Nov 7, 2016

node index.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment