2

I was wondering what could be the easiest way to allow users to edit HTML and CSS files that were uploaded to the meteor server, simulating what we can do when inspecting code in the browser, and then saving changes. I'm not talking about dynamic editing of style or simple DOM changes where we grab the element we want and change/add/remove attributes. Or putting it another way: how do we write and save files on the meteor server by accessing the app that is running on those files.

Paulo Janeiro
  • 3,181
  • 4
  • 28
  • 46
  • If you run Meteor in development mode (i.e. `meteor run`), then the files that make up the app are served to the client. If you run in production (`meteor build`), then a different set of files are copied in a temporary directory and served to the client. – Dan Dascalescu Feb 22 '15 at 10:18
  • Good point. But I want to do this in production and allow some users to edit just a small selected portion of HTML and CSS and then save it back to the source code. – Paulo Janeiro Feb 22 '15 at 11:22

1 Answers1

2

that's an interesting question. There is a relatively easy way to allow users to edit CSS and see the changes applied to the meteor app if you store the CSS in the database and apply the CSS to the CSSOM when the page loads or the user makes edits.

here is the method to append arbitrary css

Check out Meteorpad , I think it writes the app files to and from the database, but it somehow manages to compile them and run the app, as you would in a normal development environment by restarting the server or pushing code to the client. quite clever and I am also trying to learn more about they did it.

Community
  • 1
  • 1
looshi
  • 1,226
  • 2
  • 9
  • 23