Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

Command line support #67

Closed
garygreen opened this issue Aug 26, 2015 · 5 comments
Closed

Command line support #67

garygreen opened this issue Aug 26, 2015 · 5 comments

Comments

@garygreen
Copy link

It would be cool if you could use this plugin manually via command line, that way you could use it without grunt (if you happen to simply use npm as build tool).

timegrunt --start 'building css'
timegrunt --end 'building css'
timegrunt --render
@sindresorhus
Copy link
Owner

For it to know the time each task takes you would have to specify your run script as arguments to timegrunt:

$ timegrunt eslint mocha 'uglify src/app.js > dist/app.js'

@garygreen
Copy link
Author

That's not really ideal though because it would mean one massive line of tasks / build configurations.

Ideally it would be nice if this plugin was split into two repositories; time-node and time-grunt. The time-node would be responsible for exposing an api to log .start and .end events for tasks, plus rendering (and expose CLI). The grunt task would just call api methods on it. That gives full flexibility in how you want to use the timer; in grunt, through CLI, or even by node thru the api itself. What do you think?

@garygreen
Copy link
Author

Similar to how a lot of profiler apps works -- just .start('name of task') then .end('name of task') and it can calculate how long it took. Similar thru the CLI it would be, with any mixture of tasks etc:

timegrunt --start 'building css'
timegrunt --end 'building css'
timegrunt --render

@garygreen
Copy link
Author

This is kind of how I envisaged using it:

"scripts": {
    "build": "timegrunt --start 'building...' && npm run clean && npm run js && npm run css",

    "postbuild": "timegrunt --render",

    "clean": "timegrunt --start 'clean' && rimraf public/dist && timegrunt --end 'clean'",

    "js": "timegrunt --start 'js' && mkdirp public/dist/js && browserify resources/assets/js/site.js -o public/dist/js/app.js && timegrunt --end 'js'",

    "css": "timegrunt --start 'css' && lessc resources/assets/less/site.less public/dist/css/site.css && timegrunt --end 'css'"
}

@sindresorhus
Copy link
Owner

Closing as this project is deprecated because Grunt is no longer actively maintained, so it doesn't make sense for me to maintain this project either.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants