Code Monkey home page Code Monkey logo

broccoli-static-compiler's People

Contributors

ericf avatar joliss avatar linstula avatar quaertym avatar rwjblue avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

broccoli-static-compiler's Issues

corrupted files

binary files are corrupted

original : 376 Jul 18 09:38 airplay-default.png
result : 576 Jul 25 11:02 airplay-default.png

/dev/disk2 on / (hfs, local, journaled)
Darwin Davids-Mac-mini.local 13.3.0 Darwin Kernel Version 13.3.0: Tue Jun 3 21:27:35 PDT 2014; root:xnu-2422.110.17~1/RELEASE_X86_64 x86_64

osx 10.9.4

Latest broccoli-static-compiler uses the broccoli .read / .rebuild API, which is deprecated.

[API] Warning: The .read and .rebuild APIs will stop working in the next Broccoli version [API] Warning: Use broccoli-plugin instead: https://github.com/broccolijs/broccoli-plugin
[API] Warning: Plugin uses .read/.rebuild API: StaticCompiler

StaticCompiler: The .read/.rebuild API is no longer supported as of Broccoli 1.0. Plugins must now derive from broccoli-plugin. https://github.com/broccolijs/broccoli/blob/master/docs/broccoli-1-0-plugin-api.md

Exclude folder

How can folders be excluded? I tried this, but I wasn't successful:

var scripts = "scripts";
scripts = pickFiles(scripts, {
    srcDir: "/",
    destDir: "scripts",
    files: ["**/*.coffee", "!test/**/*.coffee"]
});
scripts = filterCoffeeScript(scripts, { bare: true });

Thanks a lot!

MergedTree support

A simple use-case would be when you need assets provided from broccoli.bowerTrees().

Allow file exclusion in glob patterns

It would be useful if the files glob supported excluding files that match a pattern. See https://github.com/anodynos/node-glob-expand for examples.

In my project, I have all .coffee files in the same directory, but one .coffee file needs special processing. It would be nice to say:

// Match all files except special.coffee
var files = pickFiles("/", { srcDir: "/", destDir: "/", files: ["!special.coffee"] });

// Match special.coffee and do something different with it
var special = pickFiles("/", { srcDir: "/", destDir: "/", files: ["special.coffee"] });

Currently I work around it by putting special files in their own directory, or messing with file extensions or file name patterns.

Soft links failing to merge w/ directories. Started with v1.4.0.

I'm going to do my best to explain this issue. I can create a dummy app in a repository if need be.

In our app's dist directory (after a build) we have an "assets" directory that contains javascript and other static files (images, fonts). These end up there through a series of tree nodes, however we're running into trouble with broccoli-static-compiler mixing softlinks.

This is a relative idea of the directory project structure:

app
 | - assets
   | - fonts
   | - images
 | - controllers
 | - routes
 | - templates
 | - index.html
dist
 | - index.html
 | - assets
   | - fonts
   | - images
   | - app.js
   | - vendor.js

In our Brocfile we do something like this (simplified a bit):

var pickFiles = require('broccoli-static-compiler');
var concat = require('broccoli-concat');
var mergeTrees = require('broccoli-merge-trees');

var staticAssets = pickFiles('apps/assets', { srcDir: '/', destDir: 'assets' });
var jsAssets = concat('apps', { inputFiles: [ 'app/**/*.js' ], outputFile: '/assets/app.js' });

module.exports = mergeTrees([staticAssets, jsAssets], { overwrite: true });

The error we get is:

Error: Merge error: "assets" exists as a file in ~/myapp/tmp/static_compiler-tmp_dest_dir-YGoEK39A.tmp but as a directory in ~/myapp/tmp/tree_merger-tmp_dest_dir-D11ikVu1.tmp
  at throwFileAndDirectoryCollision (~/myapp/node_modules/broccoli-merge-trees/index.js:67:13)
  at ~/myapp/node_modules/broccoli-merge-trees/index.js:35:13
  at $$$internal$$tryCatch (~/myapp/node_modules/broccoli-merge-trees/node_modules/promise-map-series/node_modules/rsvp/dist/rsvp.js:470:16)
  at $$$internal$$invokeCallback (~/myapp/node_modules/broccoli-merge-trees/node_modules/promise-map-series/node_modules/rsvp/dist/rsvp.js:482:17)
  at $$$internal$$publish (~/myapp/node_modules/broccoli-merge-trees/node_modules/promise-map-series/node_modules/rsvp/dist/rsvp.js:453:11)
  at $$rsvp$asap$$flush (~/myapp/node_modules/broccoli-merge-trees/node_modules/promise-map-series/node_modules/rsvp/dist/rsvp.js:1531:9)
  at process._tickCallback (node.js:419:13)

Now I've dissected it a bit. See here:

wesley:localhost$ ls -l tmp/static_compiler-tmp_dest_dir-YGoEK39A.tmp
15332480 0 drwx------   3 wesley  staff   102 Aug 26 22:19 .
15322967 0 drwxr-xr-x  63 wesley  staff  2142 Aug 26 22:20 ..
15332481 8 lrwxr-xr-x   1 wesley  staff    78 Aug 26 22:19 assets -> ~/myapp/apps/assets/

wesley:localhost$ ls -l tmp/tree_merger-tmp_dest_dir-D11ikVu1.tmp
15332480 0 drwx------   3 wesley  staff   102 Aug 26 22:21 .
15322967 0 drwxr-xr-x  12 wesley  staff  2142 Aug 26 22:21 ..
15332481 8 drwxr-xr-x   1 wesley  staff    78 Aug 26 22:21 assets

wesley:localhost$ ls -l tmp/tree_merger-tmp_dest_dir-D11ikVu1.tmp/assets
15332480 0 drwx------   3 wesley  staff   102 Aug 26 22:23 .
15322967 0 drwxr-xr-x  51 wesley  staff  2142 Aug 26 22:22 ..
15332481 8 -rwxr-xr-x   1 wesley  staff    78 Aug 26 22:23 output.js

I converted to relative file paths for readability

I'm not sure if it's real clear from looking at that, but the problem simply put is that broccoli-static-compiler is choosing to softlink things that are later causing problems with a merge. I'm not sure how to handle this, clearly I should be able to merge these trees.

Also, this just started happening after an npm clean and npm install. I can't explain that. The node-symlink-or-copy package has been in master for over a month and somehow I've just been biten by it.

Any thoughts would be greatly appericated.

Ignore folders when picking files with multiglob

I have a folder structure like:

images/
  <a few image files>
  emoji/
    <tons of emoji files>

Trying to pick files like:

var staticTree = pickFiles("app", {
  srcDir: '',
  files: [
    'images/{,*/}*',
  ],
  destDir: '/'
});

And it keeps choking because it's trying to treat images/emoji as a file, when its actually a directory with many files contained within it. Is there any harm in just ignoring directories in your multiglob results?

non-match on files throws error

Jo,

When an element in the files property does not match anything in the source trees it throws an error. At least for wildcarded properties this seems like unwanted behaviour.

For instance, I have a set of bower dependencies which have images mixed into their CSS directories. Annoying but unavoidable so I use files as a filter for image filetypes:

var imagesInStyleDirectory = mergeTrees([
    'bower_components/highlightjs/styles',
    'bower_components/select2',
]);
var stylishImages = pickFiles(imagesInStyleDirectory, {
    srcDir: '/',
    files: ['*.png','*.jpg','*.gif','*.ico','*.svg'],
    destDir: '/assets/css'
});

I would like to have the image file extensions be broad so that if in future an SVG or ICO image fits this pattern my configuration is flexible enough to adapt. Right now, however, I just have JPG and GIF images so the inclusion of *.svg an *.ico throws an error.

What do you think? Is the suppression of an error appropriate here or do I need to wrap with error handling to manage my requirement?

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.