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

src file is changed, not only dest #24

Closed
amitaibu opened this issue Oct 29, 2013 · 4 comments
Closed

src file is changed, not only dest #24

amitaibu opened this issue Oct 29, 2013 · 4 comments

Comments

@amitaibu
Copy link

Here's what I've defined, as I want to reload certain scripts for MOBILE. However also the original app/index.html keeps changing.
I tried to remove the inline and give a dest, but didn't work -- what am I missing? :)

preprocess: {
      mobile: {
        src: '<%= yeoman.app %>/index.html',
        options: {
          inline: true,
          context: {
            MOBILE: true
          }
        }
      },
      web: {
        src: '<%= yeoman.app %>/index.html',
        options: {
          inline: true,
          context: {
            WEB: true
          }
        }
      }
    },

HTML:

    <!-- @ifdef MOBILE -->
      <script src="cordova.js"></script>
    <!-- @endif -->
@jsoverson
Copy link
Owner

Did you give a dest in the options block, or as a sibling to src?

@amitaibu
Copy link
Author

Sibling to src.

‫ב-30 באוק 2013, בשעה 00:35, ‏Jarrod Overson notifications@github.com כתב/ה:‬

Did you give a dest in the options block, or as a sibling to src?


Reply to this email directly or view it on GitHub.

@amitaibu
Copy link
Author

My definition was wrong, I was using yeoman.app instead of yeoman.dist

For others, the correct way is:

preprocess: {
      mobile: {
        src: 'app/index.html',
        dest: '<%= yeoman.dist %>/index.html',
        options: {
          context: {
            MOBILE: true
          }
        }
      },
      web: {
        src: 'app/index.html',
        dest: '<%= yeoman.dist %>/index.html',
        options: {
          inline: true,
          context: {
            WEB: true
          }
        }
      }
    },

and added the preprocess in the end of the registered tasks.

Thanks for the help :)

@amitaibu
Copy link
Author

btw, here's my updated Gruntfie.js - hope it helps others :)

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