JavaScript Grunt.js and folder iteration + options per folder

I'm looking if its possible when using grunt to build a task that would use my folder structure to build data.

I wanted to build a website from folder structure.

For example I have:

- data
-- folder_n
--- options.json
--- webpagetext.txt
--- additional.html

etc.

Then generate my webpage also in folder structure (folder_n/{variable_as_friendly_url}.html)

Is it possible to do with grunt? I read most of docs, but did not find if that would be possible.

Edit: How would I see it in PHP

<?php
/*
    Basic project structure

    templates/
    - template_1.php
    - template_2.php
    - template_3.php
    datafeed/
    - subpage_1/
    -- header_image.png
    -- webpagetext.txt
    -- options.json
    - subpage_2/
    -- header_image.png
    -- webpagetext.txt
    -- options.json
    - subpage_3/
    -- header_image.png
    -- webpagetext.txt
    -- options.json
    - subpage_n/
    -- header_image.png
    -- webpagetext.txt
    -- options.json

*/

// IN PHP it would look like.

foreach (glob('datafeed/*') as $dir){
    foreach(glob('templates/*') as $tpl){
        constructpage($dir, $tpl);
    }
}

function constructpage($dir, $tpl) {
    $options = json_decode($dir.'options.json');
    $output_html_file_name = 'output/'.basename($dir) . '/' . basename($dir) . '.html';
    /*
        Logic that would copy, assign vars etc for template in $tpl.
    */

}

But grunt is my choice because of: I want to learn it, it got some pretty cool tools.

Answer:1

I have a regex set up to match a US-formatted date and time. It looks like this: /(\d{1,2})\/(\d{1,2})\/(\d{2,4}) (\d{1,2}):(\d{1,2})(am|pm|AM|PM|Am|Pm)/ However, I need it to also match dates that ...

I have a regex set up to match a US-formatted date and time. It looks like this: /(\d{1,2})\/(\d{1,2})\/(\d{2,4}) (\d{1,2}):(\d{1,2})(am|pm|AM|PM|Am|Pm)/ However, I need it to also match dates that ...

I am attempting to render a map of Brooklyn's building and lots using D3.js. To accomplish this task, I have done the following: Obtained shapefile from MapPLUTO: http://www.nyc.gov/html/dcp/html/...

I am attempting to render a map of Brooklyn's building and lots using D3.js. To accomplish this task, I have done the following: Obtained shapefile from MapPLUTO: http://www.nyc.gov/html/dcp/html/...

I'm building a web app where users can connect to each other and chat. So each chat holds two users. I'm having some general questions concerning Pusher API, (http://pusher.com). First question. ...

I'm building a web app where users can connect to each other and chat. So each chat holds two users. I'm having some general questions concerning Pusher API, (http://pusher.com). First question. ...

  1. pusher channels react
  2. pusher channels pricing
  3. pusher channels vs beams
  4. pusher channels vs chatkit
  5. pusher channels flutter
  6. pusher channels docs
  7. pusher channels websocket
  8. pusher channels name
  9. pusher channels methods
  10. pusher private channels
  11. pusher multiple channels
  12. pusher presence channels
  13. laravel pusher channels
  14. pusher max channels
  15. pusher js channels
  16. authenticated pusher channels
  17. using pusher channels
  18. pusher node js channels
  19. pusher subscribe multiple channels
  20. pusher vs django channels

I have a list of bootstrap component class="list-group" I have a folder of videos/category, I want to when I click on a category, the list updates without loading a page (by changing the path). Have ...

I have a list of bootstrap component class="list-group" I have a folder of videos/category, I want to when I click on a category, the list updates without loading a page (by changing the path). Have ...

  1. dynamic list html javascript
  2. dynamic list html
  3. dynamic list html jquery
  4. dynamic list html c#
  5. dynamic drop down list html
  6. dynamic search list html
  7. create dynamic list html
  8. dynamic select list html
  9. dynamic checkbox list html
  10. dynamic unordered list html
  11. dynamic list filter html
  12. dynamic list display html
  13. dynamic list data html
  14. dynamic drop down list html form
  15. dynamic drop down list html javascript
  16. dynamic drop down list html jquery
  17. dynamic list view in html
  18. dynamic drop down list html python
  19. dynamic drop down list html php
  20. dynamic drop down list html w3schools