Skip to content

Commit

Permalink
Merge pull request #9 from hexium310/read-config
Browse files Browse the repository at this point in the history
Add read config from package.json
  • Loading branch information
Jasper De Moor authored Jan 27, 2018
2 parents 6696f89 + cb32d2c commit c5107bd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ npm install parcel-plugin-svelte -D
```

## Configuration
The default configuration should work for most people but I added the possibility to define your own config values either through `svelte.config.js`(preferred method) or `.svelterc`, for documentation on which parameters u can set and use look at the official [svelte docs](https://github.com/sveltejs/svelte)
The default configuration should work for most people but I added the possibility to define your own config values any of through `svelte.config.js`(preferred method), `.svelterc`, or `svelte` field in `package.json`, for documentation on which parameters u can set and use look at the official [svelte docs](https://github.com/sveltejs/svelte)
```Javascript
// Used by svelte.compile
compilerOptions: {
Expand Down
6 changes: 3 additions & 3 deletions src/SvelteAsset.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ class SvelteAsset extends JSAsset {
preprocess: undefined
};

const customConfig = await this.getConfig(['.svelterc', 'svelte.config.js']);
const customConfig = await this.getConfig(['.svelterc', 'svelte.config.js', 'package.json']);
if (customConfig) {
svelteOptions = Object.assign(svelteOptions, customConfig);
svelteOptions = Object.assign(svelteOptions, customConfig.svelte || customConfig);
}

if (svelteOptions.preprocess) {
Expand All @@ -38,4 +38,4 @@ class SvelteAsset extends JSAsset {
}
}

module.exports = SvelteAsset;
module.exports = SvelteAsset;

0 comments on commit c5107bd

Please sign in to comment.