Giter Club home page Giter Club logo

Comments (8)

phated avatar phated commented on July 30, 2024

Would the Grunt 0.4 pattern of '/path/to/dest': ['path/to/src/'] solve this for you? You can find the implementation at https://github.com/phated/grunt-jade/tree/grunt0.4

from grunt-jade.

juriejan avatar juriejan commented on July 30, 2024

That'll solve it for me.

I'll use richardbutler's branch till I can upgrade to Grunt 0.4.

from grunt-jade.

phated avatar phated commented on July 30, 2024

I will look into back-porting the changes to master branch as I move to the 0.4 release of this plugin.

from grunt-jade.

gonzaloruizdevilla avatar gonzaloruizdevilla commented on July 30, 2024

What I need is Ruchard Butlers commit. I'll explain my use case:
I have a jade template in

/app/view/jade/list/detail.jade

and I want it to be compiled to

/app/view/list/detail.html

Right now the jade grunt plugin compiles it to

/app/view/detail.html

so I lose the the folder structure (/list/).

With Butler's commit I use this configuration:

   jade: {
      html: {
        src: ['app/views/jade/**/*.jade'],
        dest: 'app/views',
        options: {
          basePath: 'app/views/jade',
          client: false
        }
      }
    },

This works thanks to the changes:

35   -      , files = grunt.file.expandFiles(this.file.src);
    35  +      , files = grunt.file.expandFiles(this.file.src)
    36  +      , basePath = options.basePath;

and

     44 +        , outputDir = basePath ? path.dirname(path.relative(basePath, filepath )) + "/" : ""
43 45            , src = grunt.file.read(filepath)
44      -        , outputFilename = path.basename(filepath, fileExtname)
     46 +        , outputFilename = outputDir + path.basename(filepath, fileExtname)

from grunt-jade.

phated avatar phated commented on July 30, 2024

With the new syntax, you could do:

jade: {
  html: {
    files: {
      'app/views': ['app/views/jade/*.jade'],
      'app/views/list': ['app/views/jade/list/*.jade']
    },
    options: {
      client: false
    }
  }
}

But I see how that might be a pain to specify multiple or multi-level structures, so I will take a look at implementing basePath.

from grunt-jade.

juriejan avatar juriejan commented on July 30, 2024

Shouldn't the following just keep the folder structure?

jade: {
  html: {
    files: {
      'app/views/**/*.js': 'app/views/jade/**/*.jade'
    }
  }
} 

from grunt-jade.

willthemoor avatar willthemoor commented on July 30, 2024

Yes! Glad I found this. Would love to see it merged in.

from grunt-jade.

phated avatar phated commented on July 30, 2024

Added and published to NPM, thanks to everyone that participated on this issue.

from grunt-jade.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.