MCPcopy Create free account
hub / github.com/11ty/dev-server / reloadFiles

Method reloadFiles

server.js:968–998  ·  view source on GitHub ↗
(files, useDomDiffingForHtml = true)

Source from the content-addressed store, hash-verified

966 }
967
968 reloadFiles(files, useDomDiffingForHtml = true) {
969 if(!Array.isArray(files)) {
970 throw new Error("reloadFiles method requires an array of file paths.");
971 }
972
973 let subtype;
974 if(!files.some((entry) => !entry.endsWith(".css"))) {
975 // only if all changes are css changes
976 subtype = "css";
977 }
978
979 let templates = [];
980 if(useDomDiffingForHtml && this.options.domDiff) {
981 for(let filePath of files) {
982 if(!filePath.endsWith(".html")) {
983 continue;
984 }
985 for(let templateEntry of this.getBuildTemplatesFromFilePath(filePath)) {
986 templates.push(templateEntry);
987 }
988 }
989 }
990
991 this.reload({
992 files,
993 subtype,
994 build: {
995 templates
996 }
997 });
998 }
999
1000 reload(event = {}) {
1001 let { subtype, files, build } = event;

Callers 1

watcherMethod · 0.95

Calls 2

reloadMethod · 0.95

Tested by

no test coverage detected