Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems encountered with grunt-attention #31

Closed
mdford opened this issue Jan 24, 2014 · 4 comments
Closed

Problems encountered with grunt-attention #31

mdford opened this issue Jan 24, 2014 · 4 comments

Comments

@mdford
Copy link

mdford commented Jan 24, 2014

I am encountering an error trying to add grunt-attention to lineman-angular. I ran this by Foxandxss on irc #angularjs tonight and he suggested I create a new issue.

My application,js file is at https://gist.github.com/mdford/8590243 (I have stripped it down to just this module).

It works if I run >>lineman grunt attention

However, if I try to run >>lineman build I get the following error:

lineman build
Running "common" task
Warning: Task "ngtemplates" not found. Use --force to continue.
Aborted due to warnings.

I am running lineman v 0.23.2

Any thoughts?

Thanks!

Mark

@searls
Copy link
Member

searls commented Jan 24, 2014

Ah, you just ran into an edge case that I can't believe we haven't seen more people hit.

Because lineman-angular is also using the loadNpmTasks property, when you set it to a flat array, you're effectively overriding its having set it.

This is not ideal and we should come up with an approach that doesn't require you to load and concat it manually, but for the meantime I can fix this for you by forking your gist and showing you a way that will work.

I didn't test this, but could you try out the following? https://gist.github.com/searls/8598140

module.exports = function(lineman){
    var app = lineman.config.application;
    return {
        config: {

            appendTasks: {
                common: app.appendTasks.common.concat("attention:s3")
            },

            loadNpmTasks: app.loadNpmTasks.concat("grunt-attention")

            attention: {
                s3: {
                    options: {
                        message: 'Files have been pushed to S3.',
                        border: 'double',
                        borderColor: 'bgGreen'
                    }
                }
            }
        }
    }
};

@mdford
Copy link
Author

mdford commented Jan 24, 2014

Thanks for the quick response.

I used the code you provided and build now works but it does not fire the attention task.

I tried running the grunt task by itself >>lineman grunt attention (and I also tried lineman grunt attention.s3) but now I get:

Warning: Task "attention" not found. Use --force to continue.
Aborted due to warnings.

Thoughts?

@mdford
Copy link
Author

mdford commented Jan 25, 2014

Hi,

I played around with the code a bit more and I have it working. I removed the config: identifier and it now appears to work. lineman build now runs AND fires the attention task and also lineman grunt attention runs the task as well.

Here is my code in application.js. Can you take a quick look and see if this is ok or if my changes will cause problems somewhere else that I might not see yet.

module.exports = function(lineman){
    var app = lineman.config.application;
    return {
    //   config: {
            appendTasks: {
                common: app.appendTasks.common.concat("attention")
            },

            loadNpmTasks: app.loadNpmTasks.concat("grunt-attention"),

            attention: {
                s3: {
                    options: {
                        message: 'Files have been pushed to S3.',
                        border: 'double',
                        borderColor: 'bgGreen'
                    }
                }
            }
        };
  //  }
};

Thanks again for your time. I am trying to get up to speed on lineman and I look forward to integrating it into my workflow!

@searls
Copy link
Member

searls commented Feb 2, 2014

Apologies for the erroneous config identifier in my example. Glad you got it working!

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

No branches or pull requests

2 participants