Giter VIP home page Giter VIP logo

grunt-header's Introduction

grunt-header

Add a header to files

Install

$ npm install --save-dev grunt-header

Usage

require('load-grunt-tasks')(grunt); // npm install --save-dev load-grunt-tasks

grunt.initConfig({
	info: 'header text',
	header: {
		dist: {
			options: {
				text: '<%= info %>'
			},
			files: {
				'dist/main.js': 'src/main.js'
			}
		}
	}
});

grunt.registerTask('default', ['header']);

Options

text

Type: string

Text to be prepended to files.

License

MIT © Sindre Sorhus

grunt-header's People

Contributors

richienb avatar sindresorhus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

richienb

grunt-header's Issues

Question about using grunt-header in multiple watch triggers

I have a watch command which when LESS files are updated it automatically compiles and minifies them (and the same with JS).

If I place a header task to be triggered by each, then it will double up the header in each file. I can see two alternatives but neither seems perfect.

  • duplicate the header into two separate header_js and header_css tasks. Each only updating their respective files.

  • Only add the header trigger to one of the watch profiles, but it updates all files. Problem here is if I add it to CSS but make a change to JS, then the new .js file will not have the header in it.

Any advice? Thanks.


watch: {
    css: {
        files: ['<%= directory %>assets/css/src/*.less', '<%= directory %>assets/css/src/*/*.less'],
        tasks: ['less','cssmin', 'header']
    },
    js: {
        files: ['<%= directory %>assets/js/*/*.js'],
        tasks: ['concat', 'uglify', 'header'],
    }
}

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.