Coder Social home page Coder Social logo

grunt-html-build's Introduction

SPA Tools Build Status

SPA Tools is a set of tools and modules to help building Single Page Applications and other modern web applications.

It use extend and unify common libraries likes knockout.js and underscore.js and provide many modules to help creating complex javascript application.

It also contains a javascript ORM built on knockout which helps querying and synchronizing remote REST/OData Service with transparent offline support.

Installation

See installation.

Documentation

See documentation.

Release History

See release history.

grunt-html-build's People

Contributors

arronm avatar clangen avatar darkpsy avatar devoll avatar felixfurtmayr avatar giolvani avatar imjared avatar jimjamjoh avatar megawac avatar olendavis avatar prayagverma avatar pythonandchips avatar robinboehm avatar schoes avatar somaticit avatar timhettler avatar yangit avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

grunt-html-build's Issues

URL's not using base path

When I see injected assets in my index.html file the relative path is being used.

For example:

<script type="text/javascript" src="js/controllers.js"></script>

Shouldn't it be:

<script type="text/javascript" src="/js/controllers.js"></script>

Unless of course you meant for it to be relative, in which case right now I am able to acheive URL from base path by doing:

options: {
  prefix: '/',
  ...
}

How to use absolute url ?

Hi there,

I'm trying to add //maps.googleapis.com/maps/api/js?sensor=false&amp;libraries=places but it seems that is not working.

gruntfile.js part:

scripts: {
    head: [
        '//maps.googleapis.com/maps/api/js?sensor=false&amp;libraries=places',
        '<%= files.public_dir %>/js/vendor/jquery.js',
    ],
},

index.html part:

<head>
    <!-- build:script head -->
    <!-- /build -->
</head>

Is 'parseTag' mandatory?

As I followed the examples, I couldn't get it to work at all, I didn't even have errors in the console. It wasn't until I saw another example online that I noticed the "parseTag" option. I added this and it finally worked! Should this bit be in the examples? I wish it hadn't, I wouldn't have wasted an hour trying. :P

options: {
parseTag: 'htmlbuild',
beautify: true,
relative: true,
sections: {
header: '<%= yeoman.app %>/views/header.html',
footer: '<%= yeoman.app %>/views/footer.html'
}
}

If I'm wrong, please let me know why/how this should work without "parseTag".

Thank you.

Relative option doesn't work

It seem that the relative option for styles and scripts does not work. Compared to the 0.3.1 version there is a changed line in /grunt-html-build/tasks/build-html.js Line 134:

var url = options.relative ? path.relative(path.dirname(options.dest), f) : f;

If I revert this to:

var url = options.relative ? path.relative(options.dest, f) : f;

then paths are generated correctly.

Issue with file not being found

Hi there!

I'm facing a strange scenario... Right now, the config is like this:

index: {
    src: '<%= package.name %>/index.template.html'  ,
    dest: '<%= package.name %>/index.html',
    options: {
        scripts: {
            main: 'dist/js/<%= package.name %>.js'
        }   
    }
}

I'm sure that the file exists at root/packageName/dist/js/packageName.js but since the HTML is going to be relative to the dist folder, I need that to be exactly as is pointed in main.

However, in the validator, return grunt.file.expand(opt, files); is returning an empty array. According to the docs, relative should leave things as they are in the gruntfile but seems not to be happening since it's not reaching that point at all.

A small screenshot of the tree: http://cl.ly/image/352q0m3f2Y2Z

More information:

If I put the whole path to the file, at least it generates the script tag:

With relative : false:

<script type="text/javascript" src="packageName/dist/js/packageName.js"></script>

And by default:

<script type="text/javascript" src="../dist/js/packageName.js"></script>

I'm not sure what's wrong here...

Cannot call method 'indexOf' of undefined

i get this error when i try to build multiple file with the same options

Running "htmlbuild:dist" (htmlbuild) task
>> File samples\demo.html created !
Warning: Cannot call method 'indexOf' of undefined Use --force to continue.

my steps:

  1. clone the grunt-html-build source
  2. copy the example file index.html and named as demo.html
  3. change the Gruntfile.js like this:
grunt.initConfig({
        fixturesPath: "fixtures",

        htmlbuild: {
            dist: {
                src: './*.html',
                dest: './samples/',
                options: {
                    beautify: true,
                    //parseTag: 'htmlbuild',
                    scripts: {
                        bundle: [
                            '<%= fixturesPath %>/scripts/*.js',
                            '!**/main.js',
                        ],
                        main: '<%= fixturesPath %>/scripts/main.js'
                    },
                    styles: {
                        bundle: { 
                            cwd: '<%= fixturesPath %>',
                            files: [
                                'css/libs.css',
                                'css/dev.css'
                            ]
                        },
                        test: '<%= fixturesPath %>/css/inline.css'
                    },
                    sections: {
                        views: '<%= fixturesPath %>/views/**/*.html',
                        templates: '<%= fixturesPath %>/templates/**/*.html',
                    },
                    data: {
                        version: "0.1.0",
                        title: "test",
                    },
                }
            }
        }
    });

just change the src to './*.html'

  1. run grunt build and then get this error

i find that when build the second html file, the options which named params in build-html.js has been changed

i think it maybe because of this function:

function validateBlockWithName(tag, params) {
        var src = params[tag.type + "s"][tag.name];
        if (src) {
            var opt = {},
                files = src;

            if (_.isObject(src)) {
                opt = src;
                files = src.files;

                delete opt.files;
            }

            return grunt.file.expand(opt, files);
        }
    }

if i remove delete opt.files;, it work, can you help me, thanks!

Maintain files structure in dest directory

I've searched in the wiki but can't find how to make this.
i have the html files separated in a tree structure like this:

index.html
section1/

  • index.html
  • detail.html

section2/

  • index.html
  • detail.html

how can i maintain this structure in the dest folder? is it possible?
thanks

Prefix problems

In gruntfile.js, there is prefix: 'http://some.domain'
but when I run grunt task, in html, this url is translated to http:/some.domain , lack of a slash
some suggestion? thx~

'build' document search token conflicts with yeoman/grunt-usemin

The yeoman/grunt-usemin module uses the same html comment search syntax as this project to identify parseable sections. e.g.

<!-- build:js js/app.js -->

It is currently impossible to configure a project to use both grunt-html-build and grunt-usemin due to this conflict. Please make the token 'build' configurable via a Gruntfile to enable a different parse token for grunt-html-build, e.g.

<!-- htmlbuild:section views -->

Thanks, this is a great project otherwise!

Dest folder does not mirror src structure

I can't get the resulting files in dest to mirror the directory structure of src...

I have the following directory structure:

  • views
    • partial1.html
    • partial2.html
  • templates
    • page1.html
    • page2.html
    • subfolder
      • page3.html

With the src as a glob in my Gruntfile.js:

htmlbuild: {
  src: 'templates/**/*.html',
  dest: 'build/',
  ...
}

html-build picks up each of the templates in the template folder perfectly, however, when they are output they are output as follows:

  • build
    • page1.html
    • page2.html
    • page3.html

When what I really want is:

  • build
    • page1.html
    • page2.html
    • subfolder
      • page3.html

Should this happen automatically? If not, then can we make this happen as it is more similar to the behavior of other grunt packages (like https://github.com/gruntjs/grunt-contrib-copy for instance). Perhaps I am just missing an option, however. The instructions did not seem to cover this.

"<%-" oustside of process tags is being manipulated

the original template code looks like this:

<script type="text/javascript">
    $(function() {
      window.app.init(<%- JSON.stringify(config) %>);
    });
</script>

and what is generated looks like this:

<script type="text/javascript">
    $(function() {
        window.app.init( <% -JSON.stringify(config) %> );
    });
</script>

ass you can see "<%-" and "<% -" are different, causing the nodejs app that is rendering this html page not to parse and generate the config object correctly.

I'll spend some time investigating the cause of this and add my findings here.

urls are relative to the parent directory of cwd

If I run the sample in this repository, the output I get is:

<html>

    <head>
        <title>grunt-html-build - Test Page</title>
        <link type="text/css" rel="stylesheet" href="../css/libs.css" />
        <link type="text/css" rel="stylesheet" href="../css/dev.css" />
        <style>
            .this-is-inline {
                font-weight: bold;
            }
        </style>
    </head>

    <body id="landing-page">
        <div id="view1">...</div>
        <div id="view2">...</div>
        <div id="view3">...</div>
        <script type="text/javascript" src="../fixtures/scripts/app.js"></script>
        <script type="text/javascript" src="../fixtures/scripts/libs.js"></script>
        <script type="text/javascript">
            var version = "0.1.0",
                title = "test";
        </script>
        <script type="text/javascript">
            productionMain();
        </script>
    </body>

</html>

The urls should be relative to the cwd not it's parent.

Windows 8 64bit

build:remove

Following this example (https://github.com/spatools/grunt-html-build/wiki/Removing-parts), I attempt to remove a debugging block from an html set of files whenever I build for NON Development instances.

<!-- build:remove -->
<input />
<!-- /build -->

The files get replaced but the block is still there. Is this a bug, a non implemented feature or is it just me too focus on the tree that Im not seeing the naked lady in the woods behind the tree?

Different active links in navigation

Hi.
For example I have some navigation template.
Is it possible to use the same template in different pages if the active item is different for each page?

not worked when one processor defined in another processor

seems not work in this situation

    <!-- build:remove release -->
      <script type="text/javascript">
        <!-- build:process -->
        seajs.use('../static/js/index.js?_=<%= time %>');
        <!-- /build -->
      </script>
    <!-- /build -->

Is there any other solutions?

empty result

Hi, i've trying you script but I can't understand why I've no result.

The template is this:

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Corrispettivi</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">

<!-- style -->
  <!-- htmlbuild:style css-->
  <link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.min.css">
  <!-- /htmlbuild -->
<!-- style -->

this the gruntfile

  htmlbuild: {

      dist: {
        src: "src/corrispettivi.html",
        dest: "<%= distfolder %>",
        options: {
          beautify: true,
          parseTag: "htmlbuild",

          expand: true,
          logOptions: true,
          scripts: {
            bundle: "vendor/*.js",
            app: "test/*.js"
          },
          styles: {
            css: "css/*.css"
          },
          data: {
                    // Data to pass to templates
                    version: "0.1.0",
                    title: "test",
                },
        }
      }
    }

The result ...

<!DOCTYPE html>                                                            
<html lang="en">                                                           
                                                                           
<head>                                                                     
    <title>Corrispettivi</title>                                           
    <meta charset="utf-8">                                                 
    <meta name="viewport" content="width=device-width, initial-scale=1">   
                                                                           
    <!-- style -->                                                         
                                                                           
    <!-- style -->                                                         
                                                                           
                                                                           
                                                                           
                                                                           
    <!-- app -->                                                           
                                                                           
    <!-- fine -->                                                          
    <script type="text/javascript" src="js/corrispettivi.js">              
    </script>                                                              

I'm working on Windows but I've seen that the line terminate issue was closed... so Is not this. I've tried also the readme sample without success.

Some help?

Multiple sources fail to build

Great grunt-html-build builds perfect for a single "src:", but if you use an array of sources it overwrites the "/index.html" with "/aboutus/index.html" while building.

  htmlbuild: {
      dist: {
        //src: '<%= config.dist %>/index.html',
        src: ['<%= config.dist %>/index.html', '<%= config.dist %>/aboutus/index.html'],
        dest: '<%= config.dist %>',
        options: {
          beautify: true,
          prefix: '//some-cdn',
          relative: true,
          sections: {
            nav: {
              home: '<%= config.app %>/templates/nav-home.html',
              aboutus: '<%= config.app %>/templates/nav-aboutus.html'
            }
          }
        }
      }
    }

Version 1.4 does not work on CentOS 6.5

Hi, I have a problem with the latest version (1.4). It says it successfully succeeded, but when I look at the index.html, it didn't actually replace anything.

This code works fine in 1.3 though. 1.4 also works fine on my Windows 7 machine.

    htmlbuild: {
      main: {
        src: 'src/index.html',
        dest: 'dist/index.html',
        options: {
          beautify: true,
          relative: false,
          styles: {
            custom: {
              cwd: 'dist',
              files: ['styles/main.css']
            }
          },
          scripts: {
            vendors: {
              cwd: 'dist',
              files: [
                'vendors/jquery/dist/jquery.min.js',
                'vendors/bootstrap/dist/js/bootstrap.min.js',
                'vendors/jquery-sortable/source/js/jquery-sortable.min.js',
                'vendors/ng-file-upload/angular-file-upload-shim.min.js',
                'vendors/angular/angular.js',
                'vendors/angular-route/angular-route.min.js',
                'vendors/angular-animate/angular-animate.min.js',
                'vendors/angular-animate/angular-animate.min.js',
                'vendors/ng-file-upload/angular-file-upload.min.js',
                'vendors/slimScroll/jquery.slimscroll.min.js',
                'vendors/toastr/toastr.min.js'
              ]
            },
            custom: {
              cwd: 'dist',
              files: ['scripts/*.js']
            }
          }
        }
      }
    }

HTML:

    <!-- build:style custom -->
    <!-- /build -->

    <!-- build:script vendors -->
    <!-- /build -->

    <!-- build:script custom -->
    <!-- /build -->

Defer for links and scripts?

I looked through, but I can't seem to find it. Is there a way to make it so I can set links and scripts to have 'defer' in them? Or do I just have to do that manually? Would be much easier if you had a defer option that we could set to true or false.

Unable to include lodash because of '\n' and '\r'

Got this error while inlining lodash (the same happens with underscore). Of course the javascript contains those characters. How to include inline without getting the error?

Running "htmlbuild:dist" (htmlbuild) tas
A special character was detected in this template. Inside template tags, the
\n and \r special characters must be escaped as \n and \r. (grunt 0.4.0+)

htmlbuild: {
    dist: {
        options: {
            scripts: {
                utils : [
                    '<%= vendor %>/accounting.js/accounting.min.js',
                    '<%= vendor %>/store/dist/store2.min.js',
                    '<%= vendor %>/underscore.string/dist/underscore.string.min.js',
                    '<%= vendor %>/lodash/lodash.min.js'
                ],
                app: '<%= src %>/js/app.js'
            }
        },
        src: 'src/index.tpl.html',
        dest: '<%= build %>/index.html'
}

My index.tpl.html:

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <!-- build:process -->
        <title><%= pkg.name %></title>
        <!-- /build -->
    </head>
    <body>   
        <!-- build:script inline utils -->
        <!-- /build -->
    </body>
</html>

Build html file with windows line-ending in mac/linux will fail

GHB(grunt-html-build) replace raw contents's line-ending to \n and split lines with \n:

//#region Private Methods
function getBuildTags(content) {
        var lines = content.replace(/\r\n/g, '\n').split(/\n/),

In transformContent function, raw-block-lines will be concated with grunt.util.linefeed(depend on system line-ending), finally, GHB replace raw-block of raw-content with result, but the raw-block's line ending has been modified, so raw-content will not match that block:

    function transformContent(content, params, dest) {
        ......
        tags.forEach(function(tag) {
            var raw = tag.lines.join(EOL),
        ......

       content = content.replace(raw, function() {
             return result
       });

Resolve:
save \r char for raw-block:

function getBuildTags(content) {
    - var lines = content.replace(/\r\n/g, '\n').split(/\n/)
    + var lines = content.replace(/\n/g, '\n').split(/\n/)
- regexTagStartTemplate = "<!--\\s*%parseTag%:(\\w+)\\s*(inline)?\\s*(optional)?\\s*(recursive)?\\s*(noprocess)?\\s*([^\\s]*)\\s*(?:\\[(.*)\\])?\\s*-->"
- regexTagEndTemplate = "<!--\\s*\\/%parseTag%\\s*-->"

+ regexTagStartTemplate = "<!--\\s*%parseTag%:(\\w+)\\s*(inline)?\\s*(optional)?\\s*(recursive)?\\s*(noprocess)?\\s*([^\\s]*)\\s*(?:\\[(.*)\\])?\\s*-->\s*"
+ regexTagEndTemplate = "<!--\\s*\\/%parseTag%\\s*-->\s*"

Cannot read property 'name' of undefined

This seems to be an error logged by nodejs itself but occurs when processing with grunt-html-build.

Verifying property htmlbuild.main exists in config...OK
Files: build/index.html, build/interior.html -> .
Warning: An error occurred while processing a template (Cannot read property 'name' of undefined). Used --force, continuing.

gruntfile is as follows:

htmlbuild: {
      main: {
          src: 'build/*.html',
          dest: '.',
          options: {
            sections: {
                header: 'build/templates/header.html',
                footer: 'build/templates/footer.html'
            }
          }
      }
    }

using version "0.2.0"

Add link tag for less-files

LESS precompiler loads files from <link> tag with special rel attribute.
According to documentation (http://lesscss.org/) the tag should look like this:
<link rel="stylesheet/less" type="text/css" href="styles.less" />

And there is no point in writing that files inline.

The possible decision may be in letting programmer to change template
<link type="text/css" rel="stylesheet" href="<%= src %>" />.
Is it possible?

"noprocess" option not recognized?

It seems that the "noprocess" option isn't working anymore, and html-build processes all scripts.

I'm trying to inline "js-yaml", and here's the code:

<!-- build:script inline noprocess yaml -->
<script type="text/javascript"></script>
<!-- /build -->

htmlbuild is processing a "$" that's inside the minified script.

Undefined is not a function

Here is the issue I am getting:

$ grunt htmlbuild  --verbose
Initializing
Command-line options: --verbose

Reading "Gruntfile.js" Gruntfile...OK

Registering Gruntfile tasks.
Initializing config...OK
Loading "Gruntfile.js" tasks...OK
+ build, default

Running tasks: htmlbuild

Loading "grunt-html-build" plugin

Registering "/home/path/node_modules/grunt-html-build/tasks" tasks.
Loading "build-html.js" tasks...OK
+ htmlbuild

Running "htmlbuild" task

Running "htmlbuild:dist" (htmlbuild) task
Verifying property htmlbuild.dist exists in config...OK
Files: path/to/css/css.html -> path/to/css/css.html
Options: beautify=false, logOptionals=false, relative, scripts={}, styles={"critical":"path/to/css/critical.css"}, sections={}, data={}, parseTag="build"
Reading path/to/css/css.html...OK
Reading path/to/css/critical.css...OK
Warning: undefined is not a function Use --force to continue.

Aborted due to warnings.

My Grunt config (I am using load-grunt-config so this is stored in a separate file):

module.exports = function(grunt, options) {
    return {
        dist: {
            src: 'path/to/css/css.html',
            dest: 'path/to/css/css.html',
            options: {
                styles: {
                    critical: 'path/to/css/critical.css'
                }
            }
        }
    };
};

More detailed error:

TypeError: undefined is not a function
    at Object.validators.validate (/home/node_modules/grunt-html-build/tasks/build-html.js:196:44)
    at /home/node_modules/grunt-html-build/tasks/build-html.js:245:39
    at Array.forEach (native)
    at transformContent (/home/node_modules/grunt-html-build/tasks/build-html.js:242:14)
    at /home/node_modules/grunt-html-build/tasks/build-html.js:306:27
    at Array.forEach (native)
    at /home/node_modules/grunt-html-build/tasks/build-html.js:295:22
    at Array.forEach (native)
    at Object.<anonymous> (/home/node_modules/grunt-html-build/tasks/build-html.js:291:20)
    at Object.<anonymous> (/home/node_modules/grunt/lib/grunt/task.js:264:15)

Templates outside of webroot

Just looking for help... sorry for creating an issue. I've used this plugin successfully in the past, but my destination files were in the web root. This time, the files I'm replacing are outside the web root. I've spent several hours trying to figure it out and read through every issue I thought was applicable, but I just can't get there.

The directory structure is:

  • /Gruntfile.js
  • /public (webroot)
  • /public/build/css/main.min.css
  • /resources/views/layouts/default.php (layout file)

I'm trying to replace the following in the layout file

<!-- build:style main -->
<link rel="stylesheet" href="/build/css/main.dev.css">
<!-- /build -->

Desired result (dev replaced with min file):

<link type="text/css" rel="stylesheet" href="/build/css/main.min.css">

This is what I'm trying now:

htmlbuild: {
    production: {
        src: 'resources/views/layouts/**/*.php',
        options: {
            replace: true,
            prefix: '/',
            styles: {
                main: 'public/build/css/main.min.css'
            }
        }
    }
}

Here's the current result, which doesn't work because public is my web root.

<link type="text/css" rel="stylesheet" href="/public/build/css/main.min.css">

Thank you in advance for any help or direction you might have.

Add option to specify what directory to generate relative paths too

We have a frontend project in which we want to dynamically build our index html file to reference our resources depending on if we have concatenated and minified them or not (different environments).

In development though we want to try to build as little as possible and want to reference our unmodified JS and CSS files but the relative paths that are generated by html-build makes that hard for us. We get links like ../../app/main.js.

It would be nice if we could specify relative to what directory to generate the paths to like other tasks do with cwd:

files: [{
    expand: true,
    cwd: 'app/',
    src: '**/*.js',
    dest: 'build/dist/'
}]

With the above i'd like to get links like main.js.

Thanks for a really nice plugin!

Wrong compilation

I don't know if this issue happens with you, but to me, the build tag just works if it is inline

this way works:

    <!-- build:script login --><!-- /build -->

    <!-- build:process -->webshims.polyfill('forms forms-ext <%= version %>');<!-- /build -->

but this... nothing happens!

    <!-- build:script login -->
    <!-- /build -->

    <!-- build:process -->
        webshims.polyfill('forms forms-ext <%= version %>');
    <!-- /build -->

I saw the build-html.js and I found at line 267

content = content.replace(raw, function () { return result });

although the values are correct, when it tries replace, nothing happens.

For now, I will keep using the inline way...

Last version.

Hi,
Could you publish your last version in npmjs?
Thanks!

Can src render multiple files?

My dir structure:

* html
    * charselect.html
    * game.html
    * index.html

My gruntfile:

    htmlbuild: {
      dist: {
        src: 'html/*.html',
        dest: 'dist/',
        options: {
          beautify: true,
          sections: {
            banner: 'html/templates/banner.html',
            analytics: 'html/templates/analytics.html',
          }
        }
      }
    }

When I run grunt htmlbuild I'd expect it to loop through all items in html with the .html extension but it seems to only render charselect.html since it's first.

$ grunt htmlbuild
Running "htmlbuild:dist" (htmlbuild) task
File dist/charselect.html created !

Even if I pass htmlbuild a list of src files, it only iterates over the first. Ex:

    htmlbuild: {
      dist: {
        src: [
            'html/charselect.html',
            'html/game.html',
            'html/index.html',
            'html/instructions.html'
            ]
        dest: 'dist/',
        options: {
          beautify: true,
          sections: {
            banner: 'html/templates/banner.html',
            analytics: 'html/templates/analytics.html',
          }
        }
      }
    }

Is this intended functionality? If so, I may work on a pull request that would accept multiple files. If it's not intended and I'm just missing something simple, that's good to know too. My inclination is that the package can only take one file at a time.

Title tag inside SVG included in title in sitemap

I'm working on a site that needs to comply with WCAG 2.0 (https://www.w3.org/TR/WCAG20/)

In order to pass accessibility tests, SVGs need a title tag or description tag included in them. Think of it as alt text for an image. Details can be found at https://www.w3.org/TR/SVG/access.html

When using a title tag inside an SVG, the tag's content appears appended to the page's title in the HTML sitemap. It should use only the title tag in the head section.

Relative pathing from dest folder?

If the location of my file is in /dist/development/js/app.js

And I want my script tags to be:

<script type="text/javascript" src="/static/js/app.js"></script>

I would think I do something like:

htmlbuild: {
  dev: {
    src: 'src/index.html',
    dest: 'dist/development',
    options: {
      prefix: '/static/',
      relative: true,
      scripts: {
        bundle: [
        'dist/development/js/app.js',
        ]
      },
    }
  },
},

But the script tag still becomes:

<script type="text/javascript" src="/dist/development/js/app.js"></script>

What am I doing wrong here?

Data to pass to templates doesn't seem to be working

Gruntfile.js
data: {
// Data to pass to templates
title: "Some Title",
},

Src html:
<title><%= title %></title>

Dest html:
<title>
<%=t itle %>
</title>

Looks like a space is being added to the variable name. Am I doing something wrong?

Performance v0.4.0

I've tested your new version 0.4.0. The new recursive build feature is great, but the module is running very slow compared to the 0.3.2 version when processing/creating HTML files. Are working on this or this will stay so.

Here some logs

**v0.3.2**
Execution Time (2014-09-18 10:16:38 UTC)
loading tasks     3ms  ▇ 1%
htmlbuild:main  248ms  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 99%
Total 251ms
**v0.4.0**
Execution Time (2014-09-18 10:12:50 UTC)
htmlbuild:main  14s  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 100%
Total 14s

I have 42 main HTML files and including about 40 sections.

Thank you for your great work!

"$&" string inside inline script breaks everything.

Try to inline include script file consisting of one line
Consider you have following in your html file

<!--build:script inline bundle -->
<!-- /build -->

then you try to include test.js ( note inline option )
test.js

var a="$&"

Then in HTML you will get

<script type="text/javascript">var a="<!--build:script inline bundle -->
<!-- /build -->"</script>

And than everything is broken.

including multiple src and dest files

I want to do something like ::

htmlbuild: {
emp:{
src: ['app/loggedout/index.html','app/loggedout/signin.html'],
dest: ['index.html','signin.html'],
options:{
sections:{
layout:{
header: 'header.html',
footer: 'footer.html'
}
}
}
}
},

means i want to attach the same header and footer to signin and index.html , but i guess this is not the correct format .. how can i achieve this ?

No expand capability

I tried to use expand on the files and they all dumped into the same directory. To work with a tree of files I have to set up separate configs for each tree.

It would be nice if this supported standard grunt syntax for files:

http://gruntjs.com/configuring-tasks

ie conditional comment

Hello, what is the best way to enter the conditional comment for IE? in my code I have done so

<!--[if lt IE 9]>
<!-- build:script respond --><!-- /build -->  
<![endif]-->

is correct? thanks for the support.

Recursive html building

Is there a way to have the src html built recursively?

For example, if many pages use build:section layout.base, and the base has build:section layout.header, the header won't be processed and left as a comment

Output multiple pages

I have a footer and a header and a layout plus a directory full of views. It looks like this:

  • layout
    • footer.html
    • header.html
  • views
    • home.html
    • search.html
    • contact.html
  • index.html

index.html looks like this

<!-- build:section layout.header -->
<!-- /build -->

<!-- build:section views -->
<!-- /build -->

<!-- build:section layout.footer -->
<!-- /build -->

When I run grunt, I get a single index.html outputted with ALL VIEWS. How do I get it to generate a separate page for each view, using the same layout?

Relative links still not functioning correctly

I know this issue was raised/fixed a month ago but it is definitely still broken in the latest release. Given the following:

src: src/emails/test.html
dest: build/emails/test.html
stylesheet: build/vendor/ink.css

The output is:

../../vendor/ink.css

...which is one directory too far back.

Version 0.4.1 is the last version that works correctly.

Question: Is it possible for each src file to have its own destination? info inside.

I have a structure that looks like this:

views/home/IndexTemplate.html
views/authorized/IndexTemplate.html

The issue is, currently the dest is simply a directory to dump all the generated files; but what I want is to each land in their respective folders. something like:

views/home/Index.html
views/authorized/Index.html

I tried something like this before reading more into the documentation

src: 'views/**/IndexTemplate.html',
dest: 'views/**/Index.html',

but it couldn't parse /** as a directory. Do you have any suggestions here? is there a way to configure grunt-html-build to work under these conditions? or should I just change the file names to be unique?

Thanks,
Lucas

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.