Comments (4)
Hi @tvooo,
Thanks a lot for the great feedback! I'm currently in the middle of finals week, so I won't be adding anything for the next couple days, but your method of finding all tasks and subtasks is exactly what I was looking for!
Could you explain how your Sublime extension used cacheing? Were you originally running Grunt every time a user wanted to see the list of available tasks? Currently my extension parses the Gruntfile
file once on startup in a totally separate process, which helps keep the extension load time in the 10s of milliseconds. The process returns a list of tasks after it has been completed, which is saved and used whenever a user pulls up the task list.
The one downside of that is that currently any tasks added to the Gruntfile
aren't found until the Atom window is reloaded. The solution for that is probably to watch the file for changes, and get the tasks after each change.
Thanks, Nick
from atom-grunt-runner.
Hi Nick,
yeah, the problem with ST is that it runs on Python. Parsing the Gruntfile wasn't an option. So instead, we "inject" a task called expose
into grunt. In the beginning, we would spawn the grunt process with injected expose task from Python, which would output the task list as JSON that we could read from stdout.
Ergo: yes, we ran this task everytime the user wanted to see the list of tasks.
By now, the expose
task creates a cache file with the JSON-encoded task list. This cache file also includes a hash of the Gruntfile
. That way, we only have to read the cache file, compare the hash to the one of the Gruntfile
and show the tasks. Much quicker. Of course, if the hashes don't match (i.e. the Gruntfile was changed) we run the expose task before.
You could work with the same technique, an md5 hash should be fine. Just save it internally, and check if the hash changed everytime you display tasks. Should still be really quick, and the list of tasks would be up to date any time.
Good luck with your finals!
from atom-grunt-runner.
That makes sense, I think I'll try to see if I can somehow watch the file for changes. Either through an Atom API like TextBuffers' events, or through a node module. That way I can preemptively parse the Gruntfile
when it changes, instead of only realizing that it's changed when I need the tasks.
That should mean a little better UX, at the expense of an extra process running the whole time.
from atom-grunt-runner.
Maybe you can hook a function into the Atom API that gets called when files change. I can imagine that they have a mechanism for that. This way, you wouldn't have to poll all the time and the footprint would be minimal.
from atom-grunt-runner.
Related Issues (20)
- Grunt file (Gruntfile.js) fails to be loaded if it uses mocha HOT 22
- Error loading Gruntfile: gruntfile not found HOT 1
- Play sound on warning/errors while running grunt task
- Gruntfile not found (again) HOT 12
- Gruntfile not found HOT 3
- Show error symbol when watch is running HOT 1
- Support multiple Gruntfiles (multiple projects in same window) HOT 2
- Is there a way to pass arguments to a grunt task? HOT 6
- Run specific Grunt task without clicking? HOT 4
- Moving atom-grunt-runner to kokarn HOT 13
- After update to 0.13.0 stopped to run and find tasks HOT 8
- After Disable and Enable cause the package to create a new panel HOT 4
- Uncaught TypeError: this.parseGruntFile is not a function
- Make sure running works as intended with Grunt 1 HOT 2
- Atom Grunt Runner does not load properly when using 'grunt-contrib-requirejs' module HOT 14
- Ctrl + Alt + Shift + T suggestion always on top of the screen
- Doesn't run, nothing in log HOT 1
- Support Multiple Grunt Files HOT 9
- Error loading gruntfile: Gruntfile not found HOT 6
- Error: rsync exited with code 12
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from atom-grunt-runner.