MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    Divide Config.js into modules

    Scheduled Pinned Locked Moved Unsolved Feature Requests
    21 Posts 7 Posters 7.9k Views 6 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S Offline
      sdetweil @artieikon
      last edited by sdetweil

      @artieikon require is not allowed in module.js, but you could use the getScripts function to load them

      Also

      Start mm in developers mode

      npm start dev
      

      Then select the console tab to see what’s going on in the modules
      Node_helpers display info in the terminal window

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      A 1 Reply Last reply Reply Quote 0
      • ? Offline
        A Former User
        last edited by

        I always want Conditional Loading or Lazy Loading. I want programmable Pre-processor for which module should be loaded or not by just mention it.
        And if configuration for each module be separated, PPL would make less mistakes on configuration step and at least, It could be easier to find which configuration wrong.

        S A 2 Replies Last reply Reply Quote 1
        • ejay-ibmE Offline
          ejay-ibm Project Sponsor Module Developer
          last edited by

          I can only agree 1 config file per module in the config folder and you can get rid of a lot of mistake

          1 Reply Last reply Reply Quote 0
          • S Offline
            sdetweil @Guest
            last edited by

            @sean thats all cool, but will take significant rewrite of the core services…

            Sam

            How to add modules

            learning how to use browser developers window for css changes

            1 Reply Last reply Reply Quote 0
            • A Offline
              artieikon @sdetweil
              last edited by

              @sdetweil said in Divide Config.js into modules:

              @artieikon require is not allowed in module.js, but you could use the getScripts function to load them

              Also

              Start mm in developers mode

              npm start dev
              

              Then select the console tab to see what’s going on in the modules
              Node_helpers display info in the terminal window

              You are amazing! thank you so much for this

              S 1 Reply Last reply Reply Quote 0
              • A Offline
                artieikon @Guest
                last edited by

                @Sean
                Lazy loading is always a quality thing to have. Anything that takes away from startup times and pre-processing generally helps user experience greatly.

                I think it’s been overlooked because of the “hide modules using an orchestrater” so its not like functionality is being lost. But the benefit of it would still be there

                S 1 Reply Last reply Reply Quote 0
                • S Offline
                  sdetweil @artieikon
                  last edited by

                  @artieikon also, please create a config file is because of a syntax error in the config file…

                  from the MM folder do

                  npm config:check
                  

                  fix errors from the top down

                  Sam

                  How to add modules

                  learning how to use browser developers window for css changes

                  A 1 Reply Last reply Reply Quote 0
                  • S Offline
                    sdetweil @artieikon
                    last edited by

                    @artieikon yeh, but generally people startup once and it runs for months…

                    Sam

                    How to add modules

                    learning how to use browser developers window for css changes

                    1 Reply Last reply Reply Quote 0
                    • A Offline
                      artieikon @sdetweil
                      last edited by

                      @sdetweil

                      npm run config:check
                      

                      but that actually came back valid since there are no syntax errors it just blew up on me runtime. The dev mode properly shows what is the issue though

                      1 Reply Last reply Reply Quote 0
                      • BKeyportB Offline
                        BKeyport Module Developer
                        last edited by

                        I do two things myself to make it sane.

                        1st, I use geany to edit. It’s a dream to work with, and keeps all my { with my } …

                        2nd, I’ve reorganized my config file as follows (Config options and modules removed to protect secure data).

                        /* Magic Mirror
                         * Live Config
                         * By Brendan Keyport
                         */
                        
                        var config = {
                        	modules: [
                        // top_bar 
                        // top_left
                        // top_center 
                        // top_right 
                        // upper_third 
                        // middle_center 
                        // lower_third 
                        // bottom_left 
                        // bottom_center 
                        // bottom_right
                        // bottom_bar 
                        // fullscreen_above 
                        // fullscreen_below 
                        // Hidden & Background
                        // End modules before this line, do not edit below
                        ]
                        };
                        if (typeof module !== "undefined") {module.exports = config;}
                        

                        The "E" in "Javascript" stands for "Easy"

                        1 Reply Last reply Reply Quote 0
                        • 1
                        • 2
                        • 3
                        • 2 / 3
                        • First post
                          Last post
                        Enjoying MagicMirror? Please consider a donation!
                        MagicMirror created by Michael Teeuw.
                        Forum managed by Sam, technical setup by Karsten.
                        This forum is using NodeBB as its core | Contributors
                        Contact | Privacy Policy