-
Notifications
You must be signed in to change notification settings - Fork 2
Including files
SCL is file based, and has generally has a single file entry point – that is, there is a 'main' SCL file which is loaded by your application. It's possible to configure a project of any size and complexity in a single SCL file, but it may become very long. You may also want to make use of shared resources like external libraries, or simply organise your project neatly. SCL provides an include() function to make life easier.
SCL features a built in function called include(), which takes any number of string or literal arguments. Paths provided are relative to the working path of the application, and .scl will automatically be added to your requested path if you
omit it.
include("my-project/model")
include("my-project/web")
Is equivalent to:
include("my-project/model.scl")
include("my-project/web.scl")
and
include("my-project/model", "my-project/web")
or even
include(my-project/model, my-project/web)
Wildcard operators are also allowed:
include("my-project/*")
Files included using a wildcard will be loaded in alphabetical order.
The declarations in files loaded using include() will attach to the scope where the include() call was made. Any top-level declarations of mixins or variables will be available in the including file.
When include()ing files, SCL will first search in the ./vendor/ directory relative to the path of the input SCL file. If you want to make sure that your SCL file includes a file of a particular version, as opposed to whatever is on the include path, you can place it in the vendor directory.
This is especially useful in conjunction with the CLI tool, which fetches external libraries to the vendor directory by default. For more information, see the main repo page.