# Import site theme via console

**URL:** <https://meta.discourse.org/t/import-site-theme-via-console/66586>\
**Category:** Product Support\
**Created:** [21.Июль.2017 10:03:14 UTC](https://meta.discourse.org/t/import-site-theme-via-console/66586 "2017-07-21T10:03:14Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![michaeld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/michaeld/32/1594_2.png) [@michaeld](https://meta.discourse.org/u/michaeld)\
**Post date:** [22.Июль.2017 19:14:23 UTC](https://meta.discourse.org/t/import-site-theme-via-console/66586/5 "2017-07-22T19:14:23Z")

</div>

I think we’re drifting away a bit from the original question…

```
filename = '/tmp/theme.dcstyle.json'
File.open(filename) do |file|
  json = JSON::parse(file.read)
  theme = json['theme']
  puts theme
  t = Theme.new(name: theme["name"], user_id: -1)
  theme["theme_fields"]&.each do |field|
     t.set_field(target: field["target"], name: field["name"], value: field["value"])
  end
  t.save
end

```

---

_[View the full topic](https://meta.discourse.org/t/import-site-theme-via-console/66586)._
