• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
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.

Change Modules name

Scheduled Pinned Locked Moved Forum
7 Posts 5 Posters 4.0k 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.
  • P Offline
    pepemujica @yawns
    last edited by Jun 3, 2017, 11:22 PM

    @yawns great, and can I copy the folder, so I have the original module with it’s original name, and the copy with the custom name?

    M C 2 Replies Last reply Jun 3, 2017, 11:45 PM Reply Quote 0
    • M Offline
      Mykle1 Project Sponsor Module Developer @pepemujica
      last edited by Jun 3, 2017, 11:45 PM

      @pepemujica

      Yes, just make the changes that @yawns stated above

      Create a working config
      How to add modules

      1 Reply Last reply Reply Quote 0
      • C Offline
        cowboysdude Module Developer @pepemujica
        last edited by Jun 4, 2017, 1:09 AM

        @pepemujica No.

        If you have [for example] MMM-This and you want MMM-That you have to change the folder name first to MMM-That…

        Now…inside that folder change MMM-This.js to MMM-That.js

        THEN open MMM-That.js and at the top it will have this line ---->

        Module.register(“MMM-This”, {

        That has to be changed to:

        Module.register(“MMM-That”, {
        Save the file…

        NOW some issues you may encounter… IF in MMM-That there is a line like this —>

        getStyles: function() {
        return [“MMM-This.css”];
        },

        That could potentially also need to be changed… IF you change it there you must go into the directory and rename MMM-This.css to MMM-That.css

        IF you do that then you need to open MMM-That.css and inside there will be this ->>>

        .MMM-This .photo {
        width:125px;
        height:125px;
        }

        They ALL have to be changed to MMM-That as well.

        Then you have renamed it …

        1 Reply Last reply Reply Quote 0
        • S Offline
          shbatm Module Developer
          last edited by Jun 4, 2017, 4:55 PM

          On the Raspberry Pi, a shortcut to renaming all of the instances of ‘MMM-This’ inside the files is to use the following​ command. Don’t forget to navigate to the new module’s directory!

          find . -type f | xargs sed -i 's/MMM-This/MMM-That/g'

          You still need to rename the actual files.

          1 Reply Last reply Reply Quote 1
          • M Offline
            Mykle1 Project Sponsor Module Developer
            last edited by Jun 4, 2017, 7:55 PM

            Or, for those not comfortable (yet) with the terminal, just about any text editor (including the Pi’s) can do a “Find and Replace”.
            0_1496606106386_1.JPG
            .0_1496606139636_2.JPG

            Create a working config
            How to add modules

            1 Reply Last reply Reply Quote 0
            • 1 / 1
            1 / 1
            • First post
              7/7
              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