A web application to help configure Prettier settings. It provides a user interface to modify Prettier options and generate a .prettierrc.json file.
.
├── index.html
├── style.css
├── js/
│ ├── configData.js
│ ├── main.js
│ └── ui.js
└── src/
├── images/
└── logo-prettier.png
index.html: The main HTML file that provides the structure and content of the web page.style.css: Contains the CSS rules for styling the web page.js/configData.js: Holds data related to Prettier configurations or settings.js/main.js: The main JavaScript file, containing the core logic and initialisation.js/ui.js: Contains JavaScript code related to the user interface and handling user interactions.
- Download the file to your computer, and setup a localhost server via VS Code etc.
- Open
index.htmlin your web browser. - Modify the Prettier options using the user interface.
- Click the "Generate .prettierrc.json" button to generate the configuration file.
- Save the generated
.prettierrc.jsonfile to your project. - Run Prettier in your project to format your code according to the configured settings.
- The
configData.jsfile contains the default Prettier settings and options. - The
main.jsfile handles the logic for generating the.prettierrc.jsonfile based on the user's selections.
To avoid potential CORS errors when opening index.html directly in the browser, you can download and host the Prism.js files locally. Follow these steps:
-
Create a directory named
lib/prismjsin the project root. -
Download the following files from the Prism.js CDN and place them in the
lib/prismjsdirectory:- https://cdn.jsdelivr.net/npm/[email protected]/themes/prism-tomorrow.min.css (Save as
lib/prismjs/prism-tomorrow.min.css) - https://cdn.jsdelivr.net/npm/[email protected]/components/prism-core.min.js (Save as
lib/prismjs/prism-core.min.js) - https://cdn.jsdelivr.net/npm/[email protected]/plugins/autoloader/prism-autoloader.min.js (Save as
lib/prismjs/prism-autoloader.min.js)
- https://cdn.jsdelivr.net/npm/[email protected]/themes/prism-tomorrow.min.css (Save as
-
Uncommented the
index.htmlfile to reference the local Prism.js files instead of the CDN URLs, then commentted the CDN URLs:<link rel="stylesheet" href="lib/prismjs/prism-tomorrow.min.css" /> <script src="lib/prismjs/prism-core.min.js"></script> <script src="lib/prismjs/prism-autoloader.min.js" data-dependencies-path="lib/prismjs/" ></script>
This project is licensed under the MIT License - see License.md for details.