Skip to content

Commit

Permalink
fix(storefront): BCTHEME-1000 handle correctly regular css file
Browse files Browse the repository at this point in the history
  • Loading branch information
bc-alexsaiannyi committed Jan 20, 2022
1 parent e81cafa commit 2f5b01b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
# Set a consistent line-ending styles across different OS to avoid problems with linters
* text eol=lf
*.png binary
*.jpg binary
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### Draft

- fix(storefront): bctheme-1000 handle regular css in stencil ([844](https:/bigcommerce/stencil-cli/pull/844))

### 3.8.5 (2022-01-18)

- fix(storefront): strf-9594 loosed frontmatter refex ([841](https:/bigcommerce/stencil-cli/pull/841))
Expand Down
10 changes: 5 additions & 5 deletions server/plugins/theme-assets/theme-assets.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,21 +60,21 @@ internals.cssHandler = async (request, h) => {
request.app.themeConfig.setVariation(variationIndex);

// Get the theme configuration
const configuration = await request.app.themeConfig.getConfig();
const fileName = internals.getOriginalFileName(request.params.fileName);
const fileParts = path.parse(fileName);
const pathToFile = path.join(fileParts.dir, `${fileParts.name}.scss`);
const basePath = path.join(internals.getThemeAssetsPath(), 'scss');
const ext = configuration.css_compiler === 'css' ? configuration.css_compiler : 'scss';
const pathToFile = path.join(fileParts.dir, `${fileParts.name}.${ext}`);
const basePath = path.join(internals.getThemeAssetsPath(), `${ext}`);

let files;
try {
files = await promisify(cssAssembler.assemble)(pathToFile, basePath, 'scss', {});
files = await promisify(cssAssembler.assemble)(pathToFile, basePath, `${ext}`, {});
} catch (err) {
console.error(err);
throw Boom.badData(err);
}

const configuration = await request.app.themeConfig.getConfig();

const params = {
data: files[pathToFile],
files,
Expand Down

0 comments on commit 2f5b01b

Please sign in to comment.