Funkcje i zachowanie

...


Include — jak pisać

HTML
<!-- NetBundler.include("partials/header.html") -->
/// NetBundler.include("partials/header.html")
/** NetBundler.include("partials/header.html") */
CSS
/** NetBundler.include("partials/variables.css") */
JavaScript
/// NetBundler.include("modules/utils.js")

Ścieżki include

Względna ścieżka jest liczona względem pliku, który zawiera include. A relative path is resolved from the file that contains the include.

<!-- NetBundler.include("partials/header.html") -->

Ścieżka zaczynająca się od / jest liczona od wspólnego „korzenia” źródeł. A path starting with / is resolved from a shared source “root”.

<!-- NetBundler.include("/shared/footer.html") -->

Wcięcia i czytelność

NetBundler próbuje zachować estetykę pliku wynikowego: dołączona treść dostaje wcięcie zgodne z miejscem include. NetBundler tries to keep output readable: included content is indented to match the include position.


Cykle include

Pułapka: pętla includePitfall: include loops

Jeśli A includuje B, a B includuje A, powstaje cykl. NetBundler wykrywa to i przerywa budowanie. If A includes B and B includes A, you have a cycle. NetBundler detects it and stops the build.


Zasoby @ — jak działa skrót

HTML
<img src="@image.png">
<link href="@styles.css">
CSS
background-image: url(@background.jpg);
background-image: url("@background.jpg");
ZasadaRule

@ odnosi się do plików lokalnych (względem pliku źródłowego, w którym jest użyte). @ refers to local files (relative to the source file that uses it).


Kopiowanie katalogu assets

Niezależnie od @, NetBundler kopiuje całe srcAssets do dstAssets rekurencyjnie, zwykle pomijając pliki bez zmian. Independently of @, NetBundler copies srcAssets to dstAssets recursively, typically skipping unchanged files.


Tryb live — co obserwuje

Obserwowane są katalogi z src i map, katalog srcAssets oraz pliki includowane. Watched: folders from src and map, the srcAssets directory, and included files.


FAQ (skrót)FAQ (short)

@ nie znaleziony → sprawdź lokalizację pliku; include nie działa → ścieżka; cycle detected → usuń pętlę; live nie reaguje → live:true i właściwe foldery. @ not found → check file location; include doesn’t work → path; cycle detected → remove the loop; live not rebuilding → live:true and correct folders.