Style in project folder


I work in several different project, all looking very much alike each other.
I would like to add a different style to each project, preferably in the project folder.

For example:

Project 1 in /home/p1 i want a style.css, with one style
Project 2 in /home/p2 i want a style.css, with another style
And Atom should read those CSS files depending on which project i have currently opened.

Is this possible? Maybe with a JS?


You can put the following in your I can’t test this right now so it may need some tweaking

fs = require 'fs'
path = require 'path'

# name of the file containing the styles
# should be in your root directory
styleFile = path.join atom.project.getPaths()[0], 'style.css'

if fs.existsSync styleFile
  style = document.createElement 'style'
  style.type = 'text/css'
  style.innerHTML = fs.readFileSync styleFile, 'utf8'
  document.head.appendChild style


I probably miss something.
I copy those lines to init.copy, and receives “Failed to load” - unexpected identifier

Could you please elaborate - how to do this?


What’s the identifier? Can you post a screenshot of your file and also the error message?


hi, thanks for the quick reply.
I managed to do it.
Can you please help me with something else?
on the project pane, there are folder names.
is it possible to manipulate them?
for example: regarding ~/home/user/myfolder - in the project pane it shows myfolder. I would like to change it to user-myfolder


Your only option would be to hack the tree-view package, which is doable and I can tell you how, but doing so would prevent that package from receiving normal updates. You can, of course, change any part of the DOM you want to, but in order to make lasting changes in how Atom displays, you have to change the code that tells Atom what to display, which is here.


hi Scholar
I have tried and tried but failed to do something even remotely close to what I want.
would you please help me understand how to do this?


I can’t help you without knowing what you’ve done and where you ran into difficulties.