Copy Exclude?

25 views
Skip to first unread message

lok...@gmail.com

unread,
Sep 8, 2014, 2:25:28 PM9/8/14
to mimo...@googlegroups.com
I've been trying to get Mimosa working on a current project and so far it's been slow going.

One difficulty I ran into was in trying to exclude development / debug libraries from the distribution. One example, for instance, is the jquery-ui development bundle.

In my case this is in C:\Dev\CVT\source\javascripts\lib\jquery-ui\development-bundle (and my watch.sourceDir = 'source').

I tried excluding it via the copy.exclude config using string paths. I tried a bunch of different ways, for example:

exclude: ['javascripts\\lib\\jquery-ui\\development-bundle']

assuming this would exclude everything in that directory, but no luck. From looking at the source code of the copy module, in this case the check to exclude a file is:

c.exclude.indexOf(file.inputFileName) > -1

So it seems the exclude param would need to specify a full path and file name of every file you want excluded. Is this what's intended? Naively I would have expected this to be reversed:

file.inputFileName.indexOf(c.exclude) > -1


Thanks,

Loki

PS eventually I did achieve what I wanted via regex instead, but would still like to hear about the question above.

exclude: [/jquery-ui\/development-bundle/]

David Bashford

unread,
Sep 8, 2014, 3:24:37 PM9/8/14
to mimo...@googlegroups.com
c.exclude is an array, not a string, so its checking to see if the file name is in the array via Array.indexOf.

The regex option is what is meant to be used for patterns and multiple files.

Make sense?








--
You received this message because you are subscribed to the Google Groups "mimosajs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mimosajs+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

David Bashford

unread,
Sep 8, 2014, 3:27:43 PM9/8/14
to mimo...@googlegroups.com
There are lots of ways to deal with swapping libraries out between builds.  Any chance you are using require.js? We do things like swap out the dev vs prod versions of Ember by redirecting the require.js "ember" alias during the build.

lok...@gmail.com

unread,
Sep 9, 2014, 2:35:23 PM9/9/14
to mimo...@googlegroups.com
Yeah, OK. I get it. Maybe a few words of clarification in the docs that in that case Mimosa is expecting individual / specific file names, to maybe save someone else some time.

We are using require, but at this time we keep the various debug / development versions alongside the deployment ones, so the copy compiler was copying them all without the exclude config.

While I have you on the line ...

I wanted to pass the preamble flag to r.js / uglify2 to automatically include a copy right notice in the build js files. Is this possible? I tried this but it didn't seem to work:

require: {
optimize: {
overrides: {
optimize: "uglify2",
uglify2: {
preamble: "/** Copyright(c) 2014 My Company Inc. */"
}
}
}
}

Thanks for your help!

dbashford

unread,
Sep 9, 2014, 7:45:52 PM9/9/14
to mimo...@googlegroups.com, lok...@gmail.com

Added to the many excludes a brief comment that string paths should include the file name.  https://github.com/dbashford/mimosa.io/commit/04a59549a9cf79b6373f27d59a68aef6d054acc9

I put a little gist together for what we do for switching between libraries.  I think its hugely effective and a bit easier to manage.

https://gist.github.com/dbashford/579dd863709c3d9b8fa3

On your question...

Any chance you when you run optimization you are running with both the --minify and --optimize flags enabled?

lok...@gmail.com

unread,
Sep 10, 2014, 10:05:29 AM9/10/14
to mimo...@googlegroups.com, lok...@gmail.com
Thanks for those tips. At the moment I'm just using the optimize flag:

mimosa build -o

David Bashford

unread,
Sep 11, 2014, 7:48:17 AM9/11/14
to mimo...@googlegroups.com, lok...@gmail.com
If you run with the -D flag turned on, right before your file is optimized, you can see what the r.js config is that mimosa uses.

-D is spammy, but this stuff is at the very end.

Can you provide that?

On Wed, Sep 10, 2014 at 10:05 AM, <lok...@gmail.com> wrote:
Thanks for those tips.  At the moment I'm just using the optimize flag:

mimosa build -o
Reply all
Reply to author
Forward
0 new messages