Skip to content

Commit

Permalink
feat: add whitepaper format for config
Browse files Browse the repository at this point in the history
  • Loading branch information
yarastqt committed May 29, 2020
1 parent 67025f1 commit 39a85f1
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
15 changes: 15 additions & 0 deletions src/core-v2/utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
export function getCssModifierWithPlatform(value: string): string {
const [name, platform] = value.split('@')
if (platform === undefined) {
return name
}
return `${name}-${platform}`
}

export function getFolderWithPlatform(fileName: string): string {
const [name, platform] = fileName.split('@')
if (platform === undefined) {
return name
}
return `${name}/${platform}`
}
10 changes: 6 additions & 4 deletions src/core-v2/whitepaper-config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { getFolderWithPlatform } from './utils'

const whitepaper = {
space: '',
size: '',
Expand All @@ -6,16 +8,16 @@ const whitepaper = {
color: '',
}

export function createWhitepaperConfig({ source, theme }: any): any {
export function createWhitepaperConfig({ source, theme, outDir }: any): any {
return {
source,
platforms: {
css: {
buildPath: 'build/',
buildPath: outDir.endsWith('/') ? outDir : `${outDir}/`,
transformGroup: 'css',
files: Object.keys(whitepaper).map((file: any) => ({
destination: `${theme}/${file}.css`,
format: 'css/variables',
destination: `${getFolderWithPlatform(theme)}/${file}.css`,
format: 'css/whitepaper',
filter: (token: any) => token.group === file,
})),
},
Expand Down

0 comments on commit 39a85f1

Please sign in to comment.