Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Issue with preserve_dirs not working #21

Open
avalade opened this Issue · 5 comments

6 participants

@avalade
Owner

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

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

@jzorn

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

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!

@kevin-wolf

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

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
Something went wrong with that request. Please try again.