sheetloaf 1.3.0-beta.0 → 1.3.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -45,7 +45,6 @@ const sass_1 = __importDefault(require("sass"));
45
45
  const postcss_1 = __importDefault(require("postcss"));
46
46
  const configs = __importStar(require("./configs"));
47
47
  const fileFinder = __importStar(require("./fileFinder"));
48
- const sources = __importStar(require("./sources"));
49
48
  const sheetloaf = new commander_1.Command();
50
49
  sheetloaf.version("1.3.0", '-v, --version', 'Print the version of Sheetloaf.');
51
50
  let usingStdin = false;
@@ -110,16 +109,23 @@ function renderAllFiles(source) {
110
109
  });
111
110
  });
112
111
  }
113
- function renderPartially(fileName) {
112
+ function renderPartially(source, fileName) {
114
113
  if (path_1.default.basename(fileName).charAt(0) !== '_') {
115
114
  renderSass(fileName);
116
115
  }
117
116
  else {
117
+ let partialExistsInSassSources = false;
118
118
  for (let i = 0; i < sourcesChecker.length; i++) {
119
119
  if (sourcesChecker[i].containsPartial(fileName)) {
120
+ partialExistsInSassSources = true;
120
121
  renderSass(sourcesChecker[i].getMain());
121
122
  }
122
123
  }
124
+ if (partialExistsInSassSources === false) {
125
+ console.log(fileName);
126
+ sourcesChecker.splice(0, sourcesChecker.length);
127
+ renderAllFiles(source);
128
+ }
123
129
  }
124
130
  }
125
131
  function watch(source) {
@@ -136,7 +142,7 @@ function watch(source) {
136
142
  })
137
143
  .on('change', (changed) => {
138
144
  console.log(`File changed: ${changed}`);
139
- renderPartially(changed);
145
+ renderPartially(source, changed);
140
146
  })
141
147
  .on('add', (added) => {
142
148
  console.log(`File added: ${added}`);
@@ -303,13 +309,9 @@ function emitSassError(err) {
303
309
  return css;
304
310
  }
305
311
  function addResultToSourcesChecker(fileName, result) {
306
- let alreadyExists = false;
307
312
  for (let i = 0; i < sourcesChecker.length; i++) {
308
313
  if (sourcesChecker[i].getAbsoluteMain() === path_1.default.resolve(fileName)) {
309
- alreadyExists = true;
314
+ sourcesChecker[i].setSources(result.loadedUrls);
310
315
  }
311
316
  }
312
- if (alreadyExists === false) {
313
- sourcesChecker.push(new sources.SassSources(fileName, result));
314
- }
315
317
  }
package/dist/sources.js CHANGED
@@ -6,11 +6,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.SassSources = void 0;
7
7
  const path_1 = __importDefault(require("path"));
8
8
  class SassSources {
9
- constructor(filename, sassResult) {
9
+ constructor(fileName, sassResult) {
10
10
  this.sources = [];
11
- this.main = filename;
12
- this.absoluteMain = path_1.default.resolve(filename);
13
- sassResult.loadedUrls.forEach(url => {
11
+ this.main = fileName;
12
+ this.absoluteMain = path_1.default.resolve(fileName);
13
+ this.setSources(sassResult.loadedUrls);
14
+ }
15
+ setSources(urls) {
16
+ this.sources.splice(0, this.sources.length);
17
+ urls.forEach(url => {
14
18
  if (url.pathname !== this.absoluteMain) {
15
19
  this.sources.push(url.pathname);
16
20
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sheetloaf",
3
- "version": "1.3.0-beta.0",
3
+ "version": "1.3.0-beta.1",
4
4
  "description": "freshmade stylesheets for the whole family.",
5
5
  "main": "./dist/index.js",
6
6
  "bin": {