GithubHelp home page GithubHelp logo

Comments (3)

henrahmagix avatar henrahmagix commented on June 6, 2024

@AdrienGiboire The problem here is you are trying to define dev and dist targets under the process-html-template target. You can't nest targets within targets =)

From copying the README examples, you need to replace process-html-template with dev, and then duplicate and replace dev with dist, like so:

// README example
grunt.initConfig({
    template: {
        options: {
            // Options for all targets go here
        },
        yourTarget: {
            options: {
                // Target-specific options go here
            },
            files: {
                // Target-specific file lists go here
            }
        }
    }
});

// Adding your dev and dist targets.
grunt.initConfig({
    template: {
        options: {
            data: {
                'current_locale': 'en-us',
                'css_file': 'css/main.css'
            }
        },
        dev: {
            files: {
                '<%= yeoman.dev %>/index.html': ['<%= yeoman.app %>/index.html']
            }
        },
        dist: {
            files: {
                '<%= yeoman.dist %>/index.html': ['<%= yeoman.dist %>/index.html']
            }
        }
    }

Now call grunt template:dev and grunt template:dist, or just grunt template to run all the targets.

from grunt-template.

AdrienGiboire avatar AdrienGiboire commented on June 6, 2024

This is what I ended doing but I found this less flexible and neat.

Thanks for the reply :)

from grunt-template.

henrahmagix avatar henrahmagix commented on June 6, 2024

Is it that you want options per target? You can do that:

template: {
    options: {
        data: {
            'current_locale': 'en-us',
            'css_file': 'css/main.css'
        }
    },
    dev: {
        options: {
            data: {
                'name': 'dev'
            }
        },
        files: {
            'dev/index.html': ['app/index.html']
        }
    },
    dist: {
        options: {
            data: {
                'name': 'dist'
            }
        },
        files: {
            'dist/index.html': ['build/index.html']
        }
    }
}

from grunt-template.

Related Issues (9)

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.