Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hacky changes to allow easier vue plugin development in nymag/sites #202

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

reubenson
Copy link

@reubenson reubenson commented Sep 2, 2021

Vue plugin compilation is somewhat broken in nymag/sites, due to some aspect of our browserify cache implementation. When compiling assets with claycli, files such as css/_kiln-plugins.css and js/_kiln-plugins.js will be not be completely compiled, often containing the assets for the .vue file that was most recently touched.

The issue is also documented here.

This PR is not meant to be merged, but is intended to provide documentation and alternate workflow for developers who are touching kiln-plugin files often. Further discovery is needed to provide a more complete solution to the problem.

To make use of this hack in nymag/sites, just do the following:

  • follow the instructions here and pull down the claycli/vue-plugin-dev branch into /docker/repos of your local sites directory. note, you may want to add docker-compose.yml to .git/info/exclude to prevent your changes from getting committed
  • connect to the sites_app container in Docker with docker exec -it sites_app_1 bash and run npm rebuild node-sass
  • run make assets and continue developing kiln plugins within sites without having to stop your server or manually rebuild assets!

And to revert back to normal claycli asset compilation, you can either undo the changes above, or checkout master in /docker/repos/claycli.

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

glob.sync(layoutModelsGlob),
glob.sync(kilnPluginsGlob),
globFiles
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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant