Skip to content

Commit

Permalink
Merge pull request #138 from stylify/tunning7
Browse files Browse the repository at this point in the history
Tunning7
  • Loading branch information
Machy8 authored Sep 29, 2022
2 parents 85ae963 + b34b120 commit e267d93
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 53 deletions.
72 changes: 37 additions & 35 deletions packages/bundler/src/Bundler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,44 +278,46 @@ export class Bundler {
return contentOptions;
};

if (this.cssVarsDirPath) {
this.dumpVariablesIntoFile({
filePath: this.cssVarsDirPath,
fileType: 'css',
variablePrefix: '--',
variableValueSeparator: ': ',
afterValue: ';',
fileContentPrefix: ':root {\n',
fileContentSuffix: '\n}'
});
}
if (this.compilerConfig.variables) {
if (this.cssVarsDirPath) {
this.dumpVariablesIntoFile({
filePath: this.cssVarsDirPath,
fileType: 'css',
variablePrefix: '--',
variableValueSeparator: ': ',
afterValue: ';',
fileContentPrefix: ':root {\n',
fileContentSuffix: '\n}'
});
}

if (this.sassVarsDirPath) {
this.dumpVariablesIntoFile({
filePath: this.sassVarsDirPath,
fileType: 'scss',
variablePrefix: '$',
variableValueSeparator: ': ',
afterValue: ';'
});
}
if (this.sassVarsDirPath) {
this.dumpVariablesIntoFile({
filePath: this.sassVarsDirPath,
fileType: 'scss',
variablePrefix: '$',
variableValueSeparator: ': ',
afterValue: ';'
});
}

if (this.lessVarsDirPath) {
this.dumpVariablesIntoFile({
filePath: this.lessVarsDirPath,
fileType: 'less',
variablePrefix: '@',
variableValueSeparator: ': '
});
}
if (this.lessVarsDirPath) {
this.dumpVariablesIntoFile({
filePath: this.lessVarsDirPath,
fileType: 'less',
variablePrefix: '@',
variableValueSeparator: ': '
});
}

if (this.stylusVarsDirPath) {
this.dumpVariablesIntoFile({
filePath: this.stylusVarsDirPath,
fileType: 'styl',
variablePrefix: '',
variableValueSeparator: ' = '
});
if (this.stylusVarsDirPath) {
this.dumpVariablesIntoFile({
filePath: this.stylusVarsDirPath,
fileType: 'styl',
variablePrefix: '',
variableValueSeparator: ' = '
});
}
}

this.configurationLoadingPromise = null;
Expand Down
18 changes: 8 additions & 10 deletions packages/nuxt-module/playground/stylify.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@ import { defineConfig } from '../esm';

export default defineConfig({
sassVarsDirPath: './assets',
extend: {
compiler: {
components: {
button: 'color:blue'
}
},
loaders: [
{ test: /\.md/}
]
}
compiler: {
components: {
button: 'color:blue'
}
},
loaders: [
{ test: /\.md/}
]
});
14 changes: 6 additions & 8 deletions packages/nuxt/playground/stylify.config.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import { defineConfig } from '@stylify/unplugin';

export default defineConfig({
extend: {
compiler: {
variables: {
red: 'darkred'
},
components: {
button: 'color:blue'
}
compiler: {
variables: {
red: 'darkred'
},
components: {
button: 'color:blue'
}
}
});

0 comments on commit e267d93

Please sign in to comment.