Skip to content

Theme name injection in theme/style.css not working #19

Description

@babblebey

Following all files copy operation to working directory in cli process, theme name injection into theme/style.css isn't working as expected leaving the placeholder $cwpt string un-replaced.

The issue comes from concurrent operation that happened in the line below

https://github.com/babblebey/wp-theme/blob/d60df48fb35f08b4becdf9553e574dc91f9c57d9/cli/index.js#L71-L75

...where the injectThemeName can be assumed to have done its phase of the operation of replacing the appropriate placeholder, but ends up getting overwritten by the injectCSSFramework operation, due to the fact that they at some point might be working with stale/outdated content from the styleCssContent.

Suggested Fix

Allow newer reading of style.css file content, doing away with the const styleCssContent = fs.readFileSync(styleCssFile, "utf-8"); variable definition which is bound to hold the content at a certain state that can quickly become stale.

This could be to just ready the file directly as argument when running the inject utilities.. i.e.

injectThemeName(styleCssFile, fs.readFileSync(styleCssFile, "utf-8"), themeName);
injectCSSFramework(styleCssFile, fs.readFileSync(styleCssFile, "utf-8"), cssFramework);

this way, the file is re-read at the certain state it's become after the first injection operation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug: cliSomething isn't working in the cli

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions