Skip to content

Assets folder recognition fix #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

marqdevx
Copy link
Member

  • Add new function to the export list
  • validateAssetsFolderName fixed scenario: when it is null it does not mean the name is correct

@marqdevx marqdevx requested a review from sebromero August 26, 2022 10:21
@@ -89,7 +89,8 @@ function validateSVGFiles(article){
* @returns an array of ValidationIssue objects for the found issues.
*/
function validateAssetsFolderName(article){
if(article.assets.length > 0 && article.assetsFolder === null){

if(article.assets.length > 0 && article.assetsFolder != "assets"){
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changes the behavior. "images" should also be allowed. Those cases should be handled by the assetsFolder property. If it doesn't return null, the problem is elsewhere.

Copy link
Member Author

@marqdevx marqdevx Aug 26, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then on the assetsFolder function

// Try to figure out assets path from the referenced images
        const usedAssetPaths = this.referencedImages.map((assetPath) => {
            const directory = path.dirname(assetPath)
            if(!directory) return null;
            return directory.split("/")[0]; // <-- This returns the "wrong" assets folder name
        })        

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assetsFolder just returns the folder, it doesnt matter the name, in the assets.js should be the logic which determines if it is correct or not, isnt it?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marqdevx You're right. Let me push a commit.

Copy link
Collaborator

@sebromero sebromero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sebromero sebromero merged commit b713d7e into assets-folder-fix Aug 26, 2022
@sebromero sebromero deleted the marqdevx/assets-folder-recognition-update branch August 26, 2022 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants