You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to propose a mechanism for creating partial files, which are not compiled by default, but embedded into files which reference them. It's just like bundling, but with less hassle and in a more unified approach.
As a brief example, suppose that we have 4 files:
index.ts
user.ts
_auth.ts
_position.ts
The index.ts and user.ts files can reference contents of a partial file by using simple imports. For example, if we want index.ts to reference _auth.ts and _position.ts, use the following code in the non-partial index.ts file:
import auth = require('auth');
import position = require('position');
The content of partial files should be copied and instantly evaluated in their container file. For instance, whether we would also like to use the _position.ts partial file in user.ts, use an import just like above:
import position = require('position');
Although this may seem like a regular import, it's basically an include function which copies the partial file's full content at the place desired. That means, partial files should not be reused in multiple containers, but should be used for code organisation purposes. When both index.ts and user.ts are referenced in a HTML file, the content of _position.ts will be duplicated and inserted into the 2 containers separately.
The text was updated successfully, but these errors were encountered:
Inspired by the
@import
function of SASS.I would like to propose a mechanism for creating partial files, which are not compiled by default, but embedded into files which reference them. It's just like bundling, but with less hassle and in a more unified approach.
As a brief example, suppose that we have 4 files:
The
index.ts
anduser.ts
files can reference contents of a partial file by using simple imports. For example, if we wantindex.ts
to reference_auth.ts
and_position.ts
, use the following code in the non-partialindex.ts
file:The content of partial files should be copied and instantly evaluated in their container file. For instance, whether we would also like to use the
_position.ts
partial file inuser.ts
, use an import just like above:Although this may seem like a regular import, it's basically an include function which copies the partial file's full content at the place desired. That means, partial files should not be reused in multiple containers, but should be used for code organisation purposes. When both
index.ts
anduser.ts
are referenced in a HTML file, the content of_position.ts
will be duplicated and inserted into the 2 containers separately.The text was updated successfully, but these errors were encountered: