Overview:
The @nuxtjs/pythonnpm allows users to write Nuxt.js applications using Python. Currently, it only supports the custom Javascripthon compiler, but future versions may support other compilers as well. Users can clone the example repository, install the dependencies, and run the example to get started. Additionally, users can add the @nuxtjs/python dependency to their own project, configure the nuxt.config.js file, and mark script tags in Vue files with the lang=“py” attribute. The module relies heavily on the python-webpack-loader and Javascripthon libraries.
Features:
- Write Nuxt 2 applications using Python
- Supports custom Javascripthon compiler
- Future support for other compilers
Installation:
To use @nuxtjs/pythonnpm in your project, follow these steps:
- Clone the example repository and change directory into it.
- Install the dependencies by running
npm install
oryarn install
. - Run the example using
npm run dev
.
To set up @nuxtjs/pythonnpm in your own project, you need to:
- Add the @nuxtjs/python dependency to your project using yarn or npm.
- Add @nuxtjs/python to the modules section of nuxt.config.js.
- Mark your script tags in Vue files with the lang=“py” attribute.
- Install the Javascripthon Python transpiler, preferably the master branch.
- Note that Javascripthon requires Python 3.5 or better.
- Javascripthon supports converting Python import statements to ES6 imports used in Nuxt. Be mindful of syntax conversions.
- Optional: Pass compiler options to py-loader using module options or in a python section in your nuxt.config.js file.
- If using Transcrypt, you can use the CommonJS module standard (require to import and module.exports).
- See the py-loader Vuejs example for more information.
Summary:
In summary, @nuxtjs/pythonnpm allows developers to write Nuxt.js applications using Python. It currently supports the Javascripthon compiler and provides instructions and examples for getting started. Developers can install the dependencies, configure the nuxt.config.js file, and use the lang=“py” attribute to write Python code in their Vue files. The module relies on the python-webpack-loader and Javascripthon libraries.