We are using DXA java project on 2013 Tridion. We have our own styles and scripts that we wish to upload into CMS.
First, when we unzipped the HTML design.zip (downloaded from CME) and simply zipped and uploaded the same we get the error. Could not find a part of the path 'D:\_934bc0e\src\system\assets\less\_custom.less'.
Is there any special way to zip this file. Are there any tools you use for creating the zip file. How would we create this file from our source files and what are the steps needed?
2 Answers
The layout and content of the zip is indeed very specific to the DXA - I suggest that you examine the default zip and Gruntfile.js to understand the layout and build process.
Before you invest a lot of time trying to customize the standard DXA process, perhaps you should consider deploying your CSS/JS etc. to the web applications servers outside of the CMS (maybe integrated with whatever CI/automation you are using to deploy your web app customizations). Check the section on Manually building assets in the docs.
Its not mandatory to publish the design files from the CMS - its just convenient to get everything up and running quickly and can be useful if you want to give editorial control over certain design elements (fonts, colours etc.)
The specific error you are getting is related to the DXA trying to augment the zipped CSS (LESS) with custom elements which can be specified in core or module config components. If you want to understand this particular part of the design build process, you can also check the code in the Publish HTML Design TBB
-
I am manually building the assets as per the steps given in the link. But am getting error mentioned here tridion.stackexchange.com/questions/12907/…– RacheCommented Sep 22, 2015 at 9:38
-
I was kind of assuming that you were using the .NET version - I'm not sure how/if this works with the (unofficial) Java version Commented Sep 22, 2015 at 10:02
-
Can you tell me how I can easily add custom css and scripts to the HTML Design zip.– RacheCommented Sep 22, 2015 at 10:10
-
1For CSS: assuming you know about less, just add a .less file and reference it in main.less. For JS: add a .js file and reference it in the footer.hbs file. If you are extending rather than changing the HTML design, you might want to consider doing it with a module - this can have it's own zip with less, js etc. Commented Sep 22, 2015 at 10:44
-
Ok will try first option. Any reason why we got the same error when we just unzipped and zipped it back without making any changes and published this?– RacheCommented Sep 22, 2015 at 10:54
I have also found the zip file to be a little finicky and ran into the same error as in this question. For me 7-zip was extremely useful as it allows you to update or add new files within the zip without having to extract it first. This greatly reduces the chances of messing up the layout and structure. Simply open the archive with 7-zip, navigate to the location of the file you wish to update or add, and drag the file in. Existing files will be automatically replaced and new files will be added to the archive.