-
Notifications
You must be signed in to change notification settings - Fork 0
Variables Path
Path variables create file-level dependencies by referencing other files in the project.
<< "FROM" >>
Given two files:
file.js:
import Class from '../otherfile.js';otherfile.js:
function Class () {
...
}<:import:> import <<name>> from <<"FROM".js>> <:>
The <<"FROM".js>> variable captures the file path and creates a dependency between file.js and otherfile.js. The string symbols (", ', `) do not need to be referred to in the Crodox definition - string objects get combined to an §§§ input element within the input parser.
The file extension specified in the variable determines how the path is captured:
<<"From".endung>>: a/b/c.endung
=> "From" = a/b/c
<<"From">>: a/b/c.endung
=> "From" = a/b/c.endung
When the extension is part of the variable declaration (e.g., <<"From".endung>>), it is separated from the captured path. When no extension is specified, the full path including the extension is captured.
File variables should share the same name as the file grammar definition to establish a connection:
<~"FROM".ts~> <<"FROM".ts>>
The file definition <~"FROM".ts~> and the path variable <<"FROM".ts>> both use "FROM" - this is how Crodox links a file reference to the correct subgrammar.
The Basics grammar uses path variables for imports:
<~"FROM".txt~>
<:import:> import <| <<name:up>> <||> { <<name:up>> } |> from <<"FROM".txt>> <| ; <||> \n |> <:>
In the Test_Repo, testFile.txt contains:
import { C2 } from './bridgeTest2.txt';
-
<<"FROM".txt>>captures the path./bridgeTest2(extension stripped) - Crodox matches it to the file where
FROM = ./bridgeTest2(i.e.,bridgeTest2.txt) - The imported name
C2(:upscope) becomes available intestFile.txt - References like
C2.F3()now resolve intobridgeTest2.txt
See Repo Analysis - Cross-file Dependencies for the full dependency chain.
See also: Reference Variables · Uppercase Variables · All Variables
- Getting Started
- Sign-Up
- Home Screen
- Creating Your First Template
- Template Editor
- Application Navigation
- Syntax Overview
- Workflow: End-to-End
- Workflow: Test with simpleDemo
- Workflow: Build Template from angularTemp
- Demo Repositories
- Template
- Workbench
- GitHub Integration
- GitHub App Installation
- GitHub Repository Setup
- GitHub Re-linking
- Settings
- Overview
- Declarations
- Types
- Scoping