Hot does one build public assets of a new theme ?



  • Re: How to create custom theme in Bagisto?

    I did follow the documentation instructions to start creating a new custom theme, initial instructions from documentation are quite good.
    I noticed for example on Velocity theme that there are available blade files in the following 2 places :

    • Webkul\Velocity namespace (packages directory)

    • resources/themes/velocity/views directory

    I also noticed the public/themes/velocity directory.

    Now i am wondering how does one builds - for that new theme - its public assets files inside public folder.
    The npm run development command did not work properly as well.

    In the webpack.mix.js file there is just this

    mix.js('resources/assets/js/app.js', 'public/js').sass('resources/assets/sass/app.scss', 'public/css');

    which (if i am not wrong) does not seem to me it works on the theme public assets.

    So, to recuperate, i did create a new theme named "market" for example. Did proper changes in config/themes file, by adding the needed entries. I did enable the view trace and then i see on the front that the views are coming from the folder resources/themes//market/views, which is right next to the velocity folder.

    What's the best way to work with a new custom theme ? I mean just an abstract explanation, cause i am a bit confused here. Suppose that i want to create new blade files, what are the needed steps to actually "enable them" ?
    With new js and css for my custom theme, what are the proper steps to introduce them properly to the system, including building public assets ? Do i need to create a new package for the new custom theme, just like Velocity package ?

    Hope i was clear enough.
    Thanks in advance



  • Hi.

    Yes. you'll have to create a new package if you're creating a new theme.
    Then you have to override all the necessary blade files from shop in your package.
    Then you can start customizing your own theme and publish your assets in public folder.

    You can follow the doc below to create a custom theme in bagisto.
    https://bagisto.com/en/create-custom-theme-in-bagisto/

    You can also check this video tutorial.
    https://youtu.be/Jx6K-GQ0E4k



  • @aayush-bhatt172

    Hey thanks.

    Today i have had some spare time and now i seem to get it as i dig into the code as well.
    Yes, i see in Velocity package the src, publishables directories and the webpack commands on the corresponding file inside the themes package directory.

    I think i got the gist for now.
    If any further questions i will call back later on.

    Thanks a lot again


Log in to reply