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

Issue with preserve_dirs not working #21

Open
avalade opened this issue Sep 28, 2012 · 5 comments
Open

Issue with preserve_dirs not working #21

avalade opened this issue Sep 28, 2012 · 5 comments

Comments

@avalade
Copy link
Owner

avalade commented Sep 28, 2012

As reported back on issue #11:

When I use preserve_dirs: true, it ignores dest and puts the files inside my coffee directory next to the file it is converted from, instead of in my js dir i have specified in dest. Am I doing something wrong?

{
src: [coffeeDir + '*/.coffee'],
dest: jsDir,
options: {
bare: true,
preserve_dirs: true
}
}

I've tried setting a base_dir as the js dir also, but no luck. I see you are talking about a destPath, is that different than just dest?

@johnnygreen
Copy link

Thanks! I ended up just putting my coffee and js in the same folder for now. But can't wait till this is working!

@ghost
Copy link

ghost commented Oct 1, 2012

Whoops. Works for me, can't reproduce.

src: [ 'coffee/**/*.coffee' ],
dest: 'js/src',
options: {
  bare: true,
  base_path: 'coffee',
  preserve_dirs: true
}

This works well.

@jameswyse
Copy link

I was just about to post to say I'm having a similar problem with this code (which is similar to the code I use on other plugins):

        coffee: {
            compile: {
                src: [ './app/views/scripts/**/*.coffee' ],
                dest: './staging/scripts/',
                options: {
                    bare: true,
                    preserve_dirs: true,
                    base_path: './app/views/scripts/'
                }
            }
        }

However I fixed this by removing the ./ from the path:

        coffee: {
            compile: {
                src: ['app/views/scripts/**/*.coffee'],
                dest: 'staging/scripts/',
                options: {
                    bare: true,
                    preserve_dirs: true,
                    base_path: 'app/views/scripts/'
                }
            }
        }

Not sure why this is a problem though!

@kevinwolfcr
Copy link

I have the next folder structure:

| app/
| src/
| ---- coffee/
| -------- app/
| ------------ foo/
| ---------------- bar/
| -------------------- bar.coffee
| ---------------- foo.coffee
| ------------ server.coffee
| -------- test/
| -------- public/

And i want the /src/coffee/app/ coffee files to be compiled in /app, preserving the folder structure, i mean, resulting the next folder structure.

| app/
| ---- foo/
| -------- bar/
| ------------ bar.js
| -------- foo.js
| ---- server.js

So i've used this config to the Coffee on the grunt.js:

coffee: {
    app: {
        src: ['src/coffee/app/**/*.coffee'],
        dest: 'app',
        options: {
            bare: true,
            preserve_dirs: true,
            base_path: 'src/coffee/app/'
        }
    }
}

But the output was the following:

| app/
| ---- foo/
| -------- bar/
| ------------ bar.js
| -------- foo.js
| ---- src/
| -------- coffee/
| ------------ app/
| ---------------- server.js

What i'm doing bad?

@skbailey
Copy link

skbailey commented Feb 7, 2013

I get a small issue where if I use the preserve_dirs option, any file that's not in a directory gets put into a directory in the compiled version:

app: {
    src: ['scripts/coffeescripts/app/**/*.coffee'],
    dest: 'scripts/javascripts/app/',
    options: {
          bare: false,
          preserve_dirs: true,
          base_path: 'scripts/coffeescripts/app/'
    }
}

So this:

| --- app/
| --- app/config.js
| --- app/models/sample.coffee
| --- app/views/sample.coffee

Compiles to:

| --- app/
| --- scripts/coffeescripts/app/config.js // shouldn't be in a folder since it's in the root
| --- app/models/sample.js
| --- app/views/sample.js

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

5 participants