-
Notifications
You must be signed in to change notification settings - Fork 0
Glad.imports
Glad JS edited this page Oct 14, 2017
·
1 revision
Imports is a require alias with some nifty features specifically for Glad. When using the imports method, paths are imported relative to your working directory.
Examples: (Assume imports is Glad.imports)
Both controllers and models can be imported without pluralization
imports('UserModel')
=> require('./models/user')
Importing the widget model from within the directory queries/widgets/find-by-name
imports('UserModel')
=> require('../../models/user')
Importing using reverse camelize
imports('UserQueryMocksTest')
=> require('./test/mocks/query/user')
Importing normally from within a sub-directory
imports('classes/fooze')
=> require('../../classes/fooze')