Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions cli/compile/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function handler(argv) {
const t1 = Date.now(),
media = compile.media({ watch: argv.watch }); // run media task before others (specifically, templates)

return h(media.build).collect().toArray((mediaResults) => {
return h([]).toArray((mediaResults) => {
const fonts = compile.fonts({
watch: argv.watch,
minify: argv.minify,
Expand All @@ -57,9 +57,9 @@ function handler(argv) {
globs: argv.globs,
reporter: argv.reporter
}),
tasks = [fonts, styles, templates, scripts],
tasks = [scripts],
builders = _.map(tasks, (task) => task.build),
watchers = _.map(tasks, (task) => task.watch).concat([media.watch]),
watchers = _.map(tasks, (task) => task.watch),
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in this file, we're just stripping out all build tasks except for scripts, to make compilation as fast as possible for developers who are only touching .vue files

isWatching = !!watchers[0];

return h([h.of(mediaResults)].concat(builders))
Expand Down
20 changes: 13 additions & 7 deletions lib/cmd/compile/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,8 @@ function buildScripts(entries, options = {}) {

// speed up full rebuilds for developers
if (!options.minify) {
browserifyCache(bundler, { cacheFile: browserifyCachePath });
// something in this browserifyCache call seems to be breaking compilation of vue plugin assets
// browserifyCache(bundler, { cacheFile: browserifyCachePath });
// note: this file is NOT written in production environments
}

Expand Down Expand Up @@ -436,17 +437,18 @@ function buildScripts(entries, options = {}) {
function compile(options = {}) {
const watch = options.watch || false,
minify = options.minify || variables.minify || false,
globs = options.globs || [],
// globs = options.globs || [],
globs = [],
reporter = options.reporter || 'pretty',
globFiles = globs.length ? _.flatten(_.map(globs, (g) => glob.sync(path.join(process.cwd(), g)))) : [],
// client.js, model.js, kiln plugins, and legacy global scripts are passed to megabundler
bundleEntries = glob.sync(componentClientsGlob).concat(
bundleEntries = glob.sync(kilnPluginsGlob).concat(
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

limiting script compilation to just kiln plugin files

glob.sync(componentModelsGlob),
glob.sync(componentKilnGlob),
glob.sync(layoutClientsGlob),
glob.sync(layoutModelsGlob),
glob.sync(kilnPluginsGlob),
globFiles
// glob.sync(layoutModelsGlob),
// glob.sync(kilnPluginsGlob),
// globFiles
),
// options are set beforehand, so we can grab the cached files to watch afterwards
bundleOptions = { minify, legacyFiles: globFiles },
Expand Down Expand Up @@ -482,12 +484,16 @@ function compile(options = {}) {
* would be removed from this deps file upon watch recompilation.
* @see https://github.com/clay/claycli/issues/116#issuecomment-454110714
*/
buildScripts(bundleOptions.cache.files, bundleOptions)
// limiting entrypoints to kiln directory files
let cacheFiles = bundleOptions.cache.files.filter(item => item.match(/\/kiln\//));
buildScripts( cacheFiles, bundleOptions)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

something in array of browserify-cache files/entry-points was interfering with kiln-plugin compilation. filtering that set of entry-points to just /kiln/ directory files seems to resolve the issue

.then(function (result) {
_.map(result, reporters.logAction(reporter, 'compile'));
});
// and re-copy the _client-init.js if it has changed
copyClientInit();

console.log('Recompilation in progress ...');
}
});
}
Expand Down