# Registering assets for mobile and desktop - making site responsive

**URL:** <https://meta.discourse.org/t/registering-assets-for-mobile-and-desktop-making-site-responsive/65041>\
**Category:** Development\
**Created:** [June 24, 2017, 5:04am UTC](https://meta.discourse.org/t/registering-assets-for-mobile-and-desktop-making-site-responsive/65041 "2017-06-24T05:04:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tech\_Domain](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tech_domain/32/155321_2.png) [@Tech\_Domain](https://meta.discourse.org/u/Tech_Domain)\
**Post date:** [June 24, 2017, 5:04am UTC](https://meta.discourse.org/t/registering-assets-for-mobile-and-desktop-making-site-responsive/65041/1 "2017-06-24T05:04:04Z")

</div>

I am trying to register `mobile specific stylesheet` and `desktop specific stylesheet`.  
But the discourse always takes the stylesheet which is registered last.

For example in `plugin.rb` file

```
# General change
register_asset "stylesheets/topiclist.scss"

# Desktop change
register_asset "stylesheets/desktop/topiclist.scss"

# Mobile change
register_asset "stylesheets/mobile/topiclist.scss"

```

Here the mobile stylesheet will override the previous two.

If I change the order, and keep the desktop stylesheet last, then it will override the previous ones.

So how do you make it responsive? Do we have to write the media queries ourselves, or placing the stylesheet in specific folders ( mobile, desktop etc) should make it work?

---

<div class="post-metadata">

**Author:** ![vinothkannans](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vinothkannans/32/86465_2.png) [@vinothkannans](https://meta.discourse.org/u/vinothkannans)\
**Post date:** [June 24, 2017, 8:15am UTC](https://meta.discourse.org/t/registering-assets-for-mobile-and-desktop-making-site-responsive/65041/2 "2017-06-24T08:15:57Z")

</div>

The correct code should be like below

```ruby
# General change
register_asset "stylesheets/topiclist.scss"

# Desktop change
register_asset "stylesheets/desktop/topiclist.scss", :desktop

# Mobile change
register_asset "stylesheets/mobile/topiclist.scss", :mobile

```

---

<div class="post-metadata">

**Author:** ![Tech\_Domain](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tech_domain/32/155321_2.png) [@Tech\_Domain](https://meta.discourse.org/u/Tech_Domain)\
**Post date:** [June 24, 2017, 10:32am UTC](https://meta.discourse.org/t/registering-assets-for-mobile-and-desktop-making-site-responsive/65041/3 "2017-06-24T10:32:02Z")

</div>

@vinothkannans Thanks for answer.  
But I had tried this after searching github repository. It didnt work for me, as the result was same as before.

I also tried another variation from this repo

> <https://github.com/crowdint/reading-reviews/blob/73de8ee8c8f3fb41ada0cd83a092f346ece26c2a/plugins/emoji/plugin.rb>

`register_asset('stylesheets/topiclist.scss', :desktop)`  
But this too didnt work.

I do not know Ruby very well, are the `:desktop` and `:mobile` variables available in plugin.rb file which control which stylesheet should be applicable?

---

<div class="post-metadata">

**Author:** ![nstoecki42](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nstoecki42/32/75218_2.png) [@nstoecki42](https://meta.discourse.org/u/nstoecki42)\
**Post date:** [July 13, 2017, 10:35am UTC](https://meta.discourse.org/t/registering-assets-for-mobile-and-desktop-making-site-responsive/65041/4 "2017-07-13T10:35:07Z")

</div>

I have the same issue with my markdown plugin. I tried:

```
register_css <<CSS
[...]
CSS

```

as well as

```
register_asset('stylesheets/decoration.scss')

```

but the Stylesheets seems not to be loaded!

Normally the Stylesheet Controlls `:desktop`, `:mobile` and `:all` are applicable!
