This topic contains 3 replies, has 2 voices, and was last updated by Jai Jai 3 days, 6 hours ago.

Extend Gulp Tasks for HTML Building


  • williambueti
    Participant

    Posts: 11
    Member Reply #19288

    Ideally, I’d like to have the default task also build HTML files from src to the dist without breaking any of the other tasks’ operations.

    Is there a recommended way to go about doing this?

    v5.5.2 – Demo2 – Default

    Jai
    Jai
    Keymaster

    Posts: 2627
    Support Staff Reply #19321

    Hi 🙂

    Can you please clarify what tasks did you mean? All the gulp tasks can be found in this folder tools/gulp/

    Thanks


    williambueti
    Participant

    Posts: 11
    Member Reply #19328

    So, this is how I’m doing the HTML building w/ Gulp:

    • /src
      • added /html for html templates
      • added /html_partials for template partials
    • /tools
      • /gulp/helpers.js
        • added function “htmlChannel” for html gulp compilation
        • added “html” case to output function to call “htmlChannel” and pipe output
      • /themes/metronic/default.conf.json
        • added “pages” obj to “build” obj w/ the following:
          • “src”: {“html”: [“{$config.path.src}/html/**/*.+(htm|html)”]}
          • “output”: {“html”: “{$config.output}/”}}

    What I want to know is:

    1. Is there a better way to do what I’m doing, or a recommended way?
    2. Does any of the above knock me off the upgrade path?

     

    Thanks,
    ~Will

    Jai
    Jai
    Keymaster

    Posts: 2627
    Support Staff Reply #19346

    Hi 🙂

    Okay, your gulp flow should work, by adding new gulp task. Along as you do not modify the existing gulp tasks, it should work.

    My recommended way, you grab all the HTML files with gulp without each HTML file paths.

    gulp.src(‘path/**/*.html’)

    Thanks

You must be logged in to reply to this topic.