spike icon indicating copy to clipboard operation
spike copied to clipboard

Allow configuration of src and build directories

Open jannisg opened this issue 9 years ago • 1 comments

I would love it if I could specify an output dir and a src dir to allow for a project tree more akin to:

.
├── app.js
├── app.production.js
├── package.json
├── public
├── readme.md
├── src
│   ├── assets
│   │   ├── css
│   │   │   ├── _global.css
│   │   │   └── index.css
│   │   ├── img
│   │   └── js
│   │       └── index.js
│   └── views
│       ├── index.html
│       └── layout.html
└── test
    └── compile.js

I tried setting the webpack config options for context and output.path however this currently breaks the spike compile and digging into spike-core lib a bit I saw that it was explicitly mentioned that setting those options would break spike: https://github.com/static-dev/spike-core/blob/master/lib/config.js#L166

I suppose it's a bit of a wishlist item but it would really appeal to my sense of order in the root directory having a distinction of src and public.

I think there are multiple options of supporting this, the obvious one being that we can simply use the webpack config object through context and output.path or the perhaps easier to integrate (?) through a custom path config object in the package.json something like:

{
  ...
  "spike": {
    "outputDir": "./public",
    "srcDir": "./src"
  },
  ...
}

Or it could even just come down to the CLI I suppose, something like spike compile src -o public.

If left unspecified, just use defaults as per the current configuration.

Would love to hear your thoughts.

jannisg avatar Nov 15 '16 00:11 jannisg

@jannisg yeah I'm definitely open to adding a srcDir option. Interested in taking a stab at PR'ing it?

jescalan avatar Nov 17 '16 20:11 jescalan