-
Notifications
You must be signed in to change notification settings - Fork 245
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #346 from wearebraid/feature/nuxt-module
adds nuxt module to source files and build process
- Loading branch information
Showing
3 changed files
with
133 additions
and
90 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import fs from 'fs' | ||
import path from 'path' | ||
|
||
export default function nuxtVueFormulate (moduleOptions) { | ||
let formulateOptions = Object.assign({}, this.options.formulate, moduleOptions) | ||
let configPath = false | ||
// check if we have a user-provided config path | ||
// or if a config file exists in the default location | ||
if (formulateOptions.configPath) { | ||
configPath = formulateOptions.configPath | ||
} else if (fs.existsSync(`${this.options.srcDir}/formulate.config.js`)) { | ||
configPath = '~/formulate.config.js' | ||
} | ||
// add the parsed config path back into the options object | ||
formulateOptions = Object.assign({}, formulateOptions, { configPath }) | ||
// Register `plugin.js` template | ||
this.addPlugin({ | ||
src: path.resolve(__dirname, 'plugin.js'), | ||
options: formulateOptions | ||
}) | ||
} |
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,9 @@ | ||
import Vue from 'vue' | ||
import VueFormulate from '@braid/vue-formulate' | ||
<% if (options.configPath) { %> | ||
import options from '<%= options.configPath %>' | ||
<% } else { %> | ||
const options = {} | ||
<% } %> | ||
|
||
Vue.use(VueFormulate, options) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.