# How to modify composer.js file into the plugin directory

**URL:** https://meta.discourse.org/t/how-to-modify-composer-js-file-into-the-plugin-directory/150806
**Category:** Development
**Created:** [May 8, 2020, 10:48am UTC](https://meta.discourse.org/t/how-to-modify-composer-js-file-into-the-plugin-directory/150806 "2020-05-08T10:48:01Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Siddhu\_Dhangar](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/siddhu_dhangar/32/123849_2.png) [@Siddhu\_Dhangar](https://meta.discourse.org/u/Siddhu_Dhangar)
#### Post date: [May 8, 2020, 10:48am UTC](https://meta.discourse.org/t/how-to-modify-composer-js-file-into-the-plugin-directory/150806/1 "2020-05-08T10:48:01Z")

</div>

Hi  
I am writing one plugin named discourse topic curator in which i modified the composer.hbs template file but now i want to modify the composer.js file which is present in below path,  
[https://github.com/discourse/discourse/blob/master/app/assets/javascripts/discourse/app/controllers/composer.js](https://github.com/discourse/discourse/blob/master/app/assets/javascripts/discourse/app/controllers/composer.js)

i was able to modify composer.js file but i want to ask you that how i can modify this file in the plugin without touching main composer.js file which is present in controllers directory.

i shared my github link below with you  
[https://github.com/siddhudhangar/discourse-topic-curator](https://github.com/siddhudhangar/discourse-topic-curator)

Could anybody help me out how to solve this problem ?

---

<div class="post-metadata">

### Author: ![Siddhu\_Dhangar](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/siddhu_dhangar/32/123849_2.png) [@Siddhu\_Dhangar](https://meta.discourse.org/u/Siddhu_Dhangar)
#### Post date: [May 9, 2020, 4:12pm UTC](https://meta.discourse.org/t/how-to-modify-composer-js-file-into-the-plugin-directory/150806/2 "2020-05-09T16:12:16Z")

</div>

Please anyone help me out for solving this issue ?

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [May 9, 2020, 4:25pm UTC](https://meta.discourse.org/t/how-to-modify-composer-js-file-into-the-plugin-directory/150806/3 "2020-05-09T16:25:45Z")

</div>

You should use the javascript [plugin API](https://github.com/discourse/discourse/blob/master/app/assets/javascripts/discourse/app/lib/plugin-api.js). If you explain what you’re trying to achieve, I’m sure we can work out the best API method to use.

---

<div class="post-metadata">

### Author: ![Siddhu\_Dhangar](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/siddhu_dhangar/32/123849_2.png) [@Siddhu\_Dhangar](https://meta.discourse.org/u/Siddhu_Dhangar)
#### Post date: [May 10, 2020, 10:23am UTC](https://meta.discourse.org/t/how-to-modify-composer-js-file-into-the-plugin-directory/150806/4 "2020-05-10T10:23:54Z")

</div>

I created one composer.js.es6 file in the initializers directory in composer.js.es6 file i added save method there and i was able to change some functionality of save method which is defined in composer.js file successfully using api.modifyClass function. Thank you very much @david  
for your help.
