joliss / broccoli-static-compiler

This Broccoli compiler copies static files.
MIT License
13 stars 12 forks source link

srcDir, destDir should default to '/' #3

Open MajorBreakfast opened 10 years ago

MajorBreakfast commented 10 years ago

-> title :)

joliss commented 10 years ago

I agree. :)

(Semi-relatedly, I wonder if the whole interface is due for an overhaul. I'm not terribly happy with it.)

MajorBreakfast commented 10 years ago

Observation: We always use '/' as srcDir in ember-cli

Cool would be:

// Brocfile
// import pick, merge

var es6Concatenator = new ES6Concatenator({
  loaderFile: 'loader/loader.js',
  inputFiles: [prefix + '/**/*.js'],
  outputFile: '/assets/app.js'
});

var coffee = new Coffee();

module.exports = merge(
  pick('index.html'),
  pick(['app/**/*', 'vendor/**/*']).to(coffee).to(es6Concatenator)
  pick('vendor').pick('cool.js')
)

^^' I'm being creative again. All I'm saying is that you're probably right: There is most definitly a briefer and more elegant way to pick files and wire it all up.

joliss commented 10 years ago

I originally wanted something like .to, but it would have to be added to the plugin API, and I want that API to stay as simple as humanly possible. (Tyler Kellen from the Grunt project impressed upon me that every extra piece of plugin API is terrible because you'll end up having to maintain it forever.)

ppcano commented 10 years ago

+1

match('app/**/*')
match('app/**/*', 'vendor/**/*')
ppcano commented 10 years ago

Something like to makes sense to me. I think the Brocfile.js result would be cleaner and more descriptive.

One example with rake-pipeline:

  match 'submodules/ember.js/packages_es6/*/lib/*.js' do
    filter ES6ModuleFilter
    filter Rakep::HandlebarsPrecompiler
    concat 'app.js'
  end
MajorBreakfast commented 10 years ago

@ppcano It would be kinda nice. But now I think that it doesn't need to be in the core. It could be just a library. That way the underlying interface can stay minimal and we can have syntax sugar.

stefanfisk commented 10 years ago

I've got a fork which sets srcDir and destDir to '/' by default, and that also supports passing files directly instead of wrapping in it an object, so that you can do stuff like

var es6Modules = pickFiles(src, [
  '**/*.js',
  '!main.js'
]);

Have a look at https://github.com/stefanfisk/broccoli-static-compiler.

bradleyayers commented 9 years ago

+1

rwjblue commented 9 years ago

broccoli-funnel is basically a drop in replacement and uses / as a default for srcDir and destDir.

joliss commented 9 years ago

I'm big +1 on literally any other package than broccoli-static-compiler, maintained by literally anyone other than me ;-) Yay for funnel!

rwjblue commented 9 years ago

LOL