Comments (3)
@greypants I've tried using require-dir so I dont have to manually include every directive, controller, and service file in my app(of which there are nearly 100.) It doesn't work because fs doesn't work on the frontend. How do I require all the files?
from gulp-rails-pipeline.
It's actually not RequireJS, it's CommonJS style modules. Yeah, part of the point of modules is that you don't have to namespace anymore - nothing is exposed on the window
, and everything is explicitly required.
# javascripts/models/monkey.js.coffee
module.exports = class Monkey
constructor: (@name) ->
# do some setup
# javascripts/models/zoo.js.coffee
Monkey = require('./monkey.js.coffee')
module.exports = class Zoo
constructor: () ->
monkey = new Monkey("Charley")
# ...
I wrote a little blurb on modules on my gulp-starter wiki: https://github.com/greypants/gulp-starter/wiki/What-is-a-Module%3F
That might help. If you reaaally wanted to rely on globals and namespaces, you can just change App
to window.App
and use the require-dir
module. But that kind of misses the point.
from gulp-rails-pipeline.
Is it really realistically expected of JS developers to include each one of the hundreds of files they inevitably have in a large project, one at a time? I have been stuck for hours and feel I am missing something here.
from gulp-rails-pipeline.
Related Issues (20)
- images do not load HOT 2
- Heroku - Couldn't find the file 'global' HOT 1
- npm install fails HOT 3
- Rails 4.2.1 + Sprockets 3.0.2 breaks browserSync HOT 7
- Assets not updating on Heroku HOT 1
- Access sass mixins defined in gems HOT 1
- Sass change does not call browserSync but browserify change does HOT 4
- Issue after upgrading to rails 4.2.3 and ruby 2.2.2
- Not manifesting/versioning CSS & JS HOT 7
- Icon fonts not working HOT 1
- Fails to build on heroku HOT 4
- RAILS_ENV=production rake assets:precompile fails locally HOT 1
- Having trouble deploying to Heroku HOT 3
- Can't redeploy to Heroku HOT 1
- Not compatible with Puma HOT 1
- Use gulp_asset_path in scss HOT 1
- No sass or coffee watch
- Navigation with turbolinks results in a white page with browserSync
- Doesn't compile image-url sprockets helper HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gulp-rails-pipeline.