Git Product home page Git Product logo

Comments (11)

thewalkingtoast avatar thewalkingtoast commented on May 27, 2024

Just read the comment //Ignores files/directories that start with a period (.). for file.getFilteredFileList. Obviously this is intentional so ignore this issue.

from r.js.

jrburke avatar jrburke commented on May 27, 2024

Correct, but you can override this regexp by setting dirExclusionRegExp in the build file's configuration.

from r.js.

thewalkingtoast avatar thewalkingtoast commented on May 27, 2024

Thanks for the quick reply! =) Looking at that variable, it only comes into play for directories, not files. In the if (stat.isFile()) branch, the bottom if is (line 2453) if (ok && !fileName.match(/^\./)) Files with a beginning period are always skipped?

from r.js.

thewalkingtoast avatar thewalkingtoast commented on May 27, 2024

Changing that line to if (ok && !fileName.match(file.dirExclusionRegExp)) instead fixes the issue for me.

If dirExclusionRegExp = /^\./ then .htaccess is not copied.
If dirExclusionRegExp = null then .htaccess is copied.

dirExclusionRegExp is set via my app.build.js.

from r.js.

jrburke avatar jrburke commented on May 27, 2024

Thanks for pointing out the weakness in the code. I pushed a change, and you can try r-edge.js to confirm the fix. I changed the official name of the build config to fileExclusionRegExp, but dirExclusionRegExp is still supported for backwards compatibility.

from r.js.

thewalkingtoast avatar thewalkingtoast commented on May 27, 2024

Actually it would be handy to have both, one for Dirs and one for Files. As it is currently, dirExclusionRegExp only works when it is NOT a file so changing the property name lessens the semantic meaning.

from r.js.

jrburke avatar jrburke commented on May 27, 2024

I had thought of having two different ones, but I think it was just easier to adjust the regexp to only match what did not need to be copied for both.

A common scenario would be having a .git directory that you want to ignore, but have .htaccess files you want copied, so fileExclusionRegExp = /^.git$/ would be good enough. It is also a very subtle, advanced setting and I wanted to avoid putting in two many knobs that can be twiddled.

Maybe if I expand the comment in the example.build.js to give an example of how to not copy over a .git file but do copy a .htaccess file, that would help, or did I misunderstand your point?

from r.js.

thewalkingtoast avatar thewalkingtoast commented on May 27, 2024

Nope, that makes perfect sense! =) Thanks!

from r.js.

reduxdj avatar reduxdj commented on May 27, 2024

This kind of doesn't work, I'd be happy to be wrong,
but I have all my scripts in paths like: js/models/model.js,
for instance, when I run this, the app doesn't find any path in any sub directory
beyond main main scripts path: js. Shouldn't my main.js resolve all the folders
correctly if my application works?

Why doesn't R just load my main.js and figure out all the sub directories correctly?

When I run:

node ../../r.js -o name=main out=main-built.js baseUrl=.

node.js:201
throw e; // process.nextTick error, or 'error' event on first tick

          ^

Error: Error: Error evaluating module "undefined" at location "/Users/plemiuex/Documents/fb_workspace_samsung/activation_backbone/activate/js/jquery.js":
Error: ENOENT, no such file or directory

^^^ /Users/plemiuex/Documents/fb_workspace_samsung/activation_backbone/activate/js/jquery.js is not file it's
folder.

'/Users/plemiuex/Documents/fb_workspace_samsung/activation_backbone/activate/js/jquery.js'
fileName:/Users/plemiuex/Documents/fb_workspace_samsung/activation_backbone/activate/js/jquery.js
lineNumber: undefined
http://requirejs.org/docs/errors.html#defineerror
In module tree:
main
app

at Function.onError (/Users/plemiuex/Documents/fb_workspace_samsung/activation_backbone/r.js:7911:23)
at execManager (/Users/plemiuex/Documents/fb_workspace_samsung/activation_backbone/r.js:615:28)
at /Users/plemiuex/Documents/fb_workspace_samsung/activation_backbone/r.js:643:25
at execManager (/Users/plemiuex/Documents/fb_workspace_samsung/activation_backbone/r.js:620:17)
at /Users/plemiuex/Documents/fb_workspace_samsung/activation_backbone/r.js:643:25
at execManager (/Users/plemiuex/Documents/fb_workspace_samsung/activation_backbone/r.js:620:17)
at /Users/plemiuex/Documents/fb_workspace_samsung/activation_backbone/r.js:643:25
at execManager (/Users/plemiuex/Documents/fb_workspace_samsung/activation_backbone/r.js:620:17)
at /Users/plemiuex/Documents/fb_workspace_samsung/activation_backbone/r.js:643:25
at execManager (/Users/plemiuex/Documents/fb_workspace_samsung/activation_backbone/r.js:620:17)

// main.js
require.config({
paths: {
'jquery': 'libs/jquery/jquery-1.6.4.min',
'underscore': 'libs/underscore/underscore-min',
'restDelegate': 'delegates/restDelegate',
'backbone': 'libs/backbone/backbone-amd', // AMD support
'omniture': 'libs/omniture/s_code',
'models': 'models',
'views': 'presentation/views',
'utils': 'utils',
'templates': 'presentation/templates/desktop'
},
priority: [
'underscore',
'backbone',
'jquery',
'tests/testsuite',
'app-tests']
});
require([
'domReady', // optional, using RequireJS domReady plugin
'app-tests'
], function(domReady, app){

domReady(function () {
    app.initialize();
});

});

from r.js.

jrburke avatar jrburke commented on May 27, 2024

@reduxdj: r.js does just trace the dependencies in main.js. However, by default the r.js config does not read the config values in a main.js, since they are often different (in particular things like CDN-loaded resources will not work). So, for the dependencies that have paths config are likely not being seen.

For 1.0.5 (which I want out this week), I want to make this easier by allowing you to just pass the path to your JS file that has the main config block, that work is being tracked in #81. In the meantime though, you will need to pass the config values to the r.js command. you may want to just use a build config file to store them.

from r.js.

reduxdj avatar reduxdj commented on May 27, 2024

That would be a great enhancement. Thanks for the response

from r.js.

Related Issues (20)

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.