topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday December 12, 2024, 10:36 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Modularization Magic  (Read 1061 times)

KynloStephen66515

  • Animated Giffer in Chief
  • Moderator
  • Joined in 2010
  • *****
  • Posts: 3,761
    • View Profile
    • Donate to Member
Modularization Magic
« on: March 06, 2024, 06:51 PM »
Modularization Magic ✨

This tool is designed to help web developers modularize their HTML files by extracting inline JavaScript and CSS into separate files. It also provides options to minify the extracted CSS and JS files and to compress the HTML content.

Features
  • Extract inline JavaScript and CSS from an HTML file.
  • Minify JavaScript and CSS if desired.
  • Compress HTML content if desired.
  • Create backups of the original HTML file.
  • Validate the resulting HTML using the html5validator tool.
  • Logging of the modularization process.

Requirements
  • Python 3.x
  • BeautifulSoup4:
pip install beautifulsoup4
  • cssmin:
    pip install cssmin
  • jsmin:
    pip install jsmin
  • htmlmin:
    pip install htmlmin
  • html5validator (optional for validation): Install with
    npm install -g html5validator

      Usage

      To use the HTML Modularization Tool, simply install the requirements:

      pip install -r requirements.txt

      Then run the script and follow the prompts:

      python convert.py

      You will be asked to provide paths for the input HTML file and the output files for HTML, CSS, and JS. You can also choose whether to minify the JavaScript and CSS and whether to compress the HTML content.

      Input Prompts
      • Enter the path of the input HTML file.
      • Enter the path for the output HTML file (default: output.html).
      • Enter the path for the output CSS file (default: styles.css).
      • Enter the path for the output JS file (default: scripts.js).
      • Confirm overwriting if output files already exist.
      • Choose whether to minify JS (y/n).
      • Choose whether to minify CSS (y/n).
      • Enter a custom title for the HTML document (optional).
      • Choose whether to compress HTML (y/n).

      Output
      The script will generate the following files:

      • A new HTML file with links to the external CSS and JS files.
      • An external CSS file containing all styles extracted from the HTML.
      • An external JS file containing all scripts extracted from the HTML.
      • Backup files of the original HTML content.

      Validation
      If you have html5validator installed, the script will validate the modified HTML file and report any issues.

      Logging
      The script logs the modularization process to modularization.log.

      License
      This project is open source and available under the MIT License.

      Contributions
      Contributions are welcome! Please feel free to submit a pull request.

      Support
      If you encounter any problems or have suggestions, please open an issue on the project's GitHub page.

      About Modularization Magic ✨
      Welcome to the world of Modularization Magic, where your HTML files undergo a transformation like never before! 🚀

      What is Modularization Magic?
      This enchanting script empowers you to wave a wand (or a keyboard) and effortlessly modularize your HTML files. It extracts JavaScript and CSS elements, creating separate files for a cleaner, more organized codebase.

      But that's not all! With options for minification, compression, and customization, this script adds a touch of wizardry to your web development toolkit.

      How to Unleash the Magic
      Simply run the script, answer a few prompts, and watch as it performs its spellbinding feats:

      • Extracting Scripts and Styles: The script gracefully separates scripts and styles, turning chaos into clarity.
      • Creating Backups: Fear not the unknown! The script creates backups of your original HTML, CSS, and JS files with timestamps.
      • Minification and Compression: Choose to minify your JavaScript and CSS for a streamlined, efficient enchantment. You can also compress the HTML for an added touch of magic.
      • Customization: Give your HTML document a unique identity with a custom title.
      • Validation: The script ensures your magic is in harmony with HTML5 standards by validating the modified HTML.

      Abracadabra, Your Code is Transformed!
      Let the Modularization Magic script be your trusted companion on your web development adventures. Embrace the magic, organize your code, and watch your projects sparkle with newfound brilliance!

      🧙 Happy Coding and May the Modularization Magic Be Ever in Your Favor! 🌟



      Link: https://github.com/K.../ModularizationMagic