dploy icon indicating copy to clipboard operation
dploy copied to clipboard

Using dploy with preprocessors

Open habovh opened this issue 9 years ago • 8 comments

Hi, I really like dploy, but I have one question. If I work with preprocessors like SASS/SCSS, Compass, CoffeeScript, Jade, etc, how am I supposed to deploy a website while the output of these tools is not pushed to the git repository? It would be nice to have some kind of "map" that can track GIT source files to output files, so they can be uploaded if their corresponding source file has been updated in GIT. The current workaround I am using is the "include" directive, but it is pretty straight-forward, and not really efficient for this case...

habovh avatar Feb 02 '15 18:02 habovh

What about some deploy repository or branch where you would track a builded project state? FYI: I'm using include directive atm too.

enzy avatar Feb 11 '15 16:02 enzy

What about some deploy repository or branch where you would track a builded project state?

That is not a viable solution.

Let's imagine I have a builded state branch, whenever I want to catchup from master I'll need to rebase it, and I can't have 2 different .gitignore files that will both exist in the builded state branch and the master branch : whenever I would rebase, the .gitignore file in the builded state branch will be modified.

habovh avatar Feb 11 '15 16:02 habovh

@toborrow @enzy at the moment you cannot do that, because if a file is not being tracked by git, there's no way to tell if a file has changed or not. So you have to use the "include" option. In other hand, I really like the idea to create a "mapping" option so you can connect your source files to your output files. Something like this:

map:
  "source/coffee/*.coffee": "release/js/app.js"
  "source/template/*.jade": "release/js/app.js"
  "source/stylus/*.styl": "release/css/app.css"

So this way, if you change any of your Coffee or Jade files, we upload the app.js. And if you change any of your Stylus files, we upload the app.css.

Does that makes sense? Would you need more options to the mapping maybe, like setting the remote path for your mapped file (similar to the include option)?

Well, let me know your thought on this! But I'm excited with this suggestion :)

lucasmotta avatar Feb 26 '15 14:02 lucasmotta

Hey!

Glad you like the idea! Really!

General idea

The Mapping idea seems good, but the user should be warned to first compile the corresponding source files, otherwise if we admit that the source changed, has been committed, but didn't go through a compilation process, then the files would be uploaded "as is" and there is no guarantee that the files sent over the server are actually corresponding to the rev.

To workaround this "side effect", I would suggest to also add an option when using dploy that would only send files that are handled by the map setting. Ok, this would send every file mapped, but would be nice in case we deployed without compiling, just to catch up without having to do another blank commit.

About file path

I would like to know if it is possible to upload only one file, among many in the same folder, but using the * and ** tokens in the file path. Let's say I have the following file structure (with source files and output ones) :

.
├── index.html
├── index.jade
└── javascript
    ├── app.coffee
    ├── controller
    │   ├── AppCtrl.coffee
    │   ├── AuthCtrl.coffee
    │   ├── ChooseCtrl.coffee
    │   ├── MapCtrl.coffee
    │   └── ResultsCtrl.coffee
    ├── dist
    │   ├── app.js
    │   ├── controller
    │   │   ├── AppCtrl.js
    │   │   ├── AuthCtrl.js
    │   │   ├── ChooseCtrl.js
    │   │   ├── MapCtrl.js
    │   │   └── ResultsCtrl.js
    │   └── service
    │       └── CheckToken.js
    └── service
        └── CheckToken.coffee

What would be nice, is that I set something like:

map:
  "javascript/**/*.coffee": "javascript/dist/**/*.js"
  "index.jade": "index.html"

And then, that Dploy would upload any corresponding file that has been modified since rev from the source map, and place it in the distant folder/subfolder (creating any necessary subfolder) using the same filename, but different extension. I'm unsure about if it is currently possible. You'll know better than me ;-)

What do you think? Is that possible? Does it seem user-friendly? I would definitely use deploy more often!

habovh avatar Feb 26 '15 14:02 habovh

Hey @habovh and @enzy – I'm happy to say that the new DPLOY will support this feature! It's still under development, but it's pretty much stable at the moment.

If you want to give it a try on the beta, use this branch then: https://github.com/LeanMeanFightingMachine/dploy/tree/v2-beta

lucasmotta avatar Jun 18 '15 10:06 lucasmotta

That's really great! I'll definitely try it later today!

habovh avatar Jun 18 '15 10:06 habovh

How does this work with, let's say, a Jekyll site? Basically where everything would need to be mapped to a _build dir including images. I'm assuming it would be something like:

map:
  "**/*.html": "_build/**/*.html"
  "layout/*.html": "_build/**/*.html"

But not really sure if there's a simpler way of doing this without listing out each type of file

mattfelten avatar Jun 19 '15 20:06 mattfelten

Map feature looks great. I have only one question @lucasmotta

You asked here: https://github.com/LeanMeanFightingMachine/dploy/issues/72#issuecomment-76184521

"Does that makes sense? Would you need more options to the mapping maybe, like setting the remote path for your mapped file (similar to the include option)?"

Is this feature implemented within map?

Thanks

illycz avatar Oct 18 '16 22:10 illycz