Move widget css into a controller so it's updateable

This commit is contained in:
Eric Schultz 2019-11-27 17:05:38 -06:00
parent 1cd17aa1e5
commit 564711f174
5 changed files with 14 additions and 1 deletions

View file

@ -7,4 +7,14 @@ class WidgetController < ApplicationController
def i18n def i18n
head :found, location: helpers.asset_pack_url("i18n.js"), content_type: "application/javascript" head :found, location: helpers.asset_pack_url("i18n.js"), content_type: "application/javascript"
end end
def v1_css
expires_in 10.minutes
head :found, location: helpers.stylesheet_url("widget/donate-button.css"), content_type: "text/css"
end
def v2_css
expires_in 10.minutes
head :found, location: helpers.stylesheet_url("widget/donate-button-v2.css"), content_type: "text/css"
end
end end

View file

@ -10,4 +10,4 @@ Rails.application.config.assets.version = '1.0'
# Precompile additional assets. # Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added. # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
# Rails.application.config.assets.precompile += %w( search.js ) Rails.application.config.assets.precompile += %w( widget/donate-button.css widget/donate-button-v2.css)

View file

@ -259,5 +259,8 @@ Rails.application.routes.draw do
get '/js/donate-button.v2.js' => 'widget#v2' get '/js/donate-button.v2.js' => 'widget#v2'
get '/js/i18n.js' => 'widget#i18n' get '/js/i18n.js' => 'widget#i18n'
get '/css/donate-button.css' => 'widget#v1_css'
get '/css/donate-button.v2.css' => 'widget#v2_css'
root to: 'front#index' root to: 'front#index'
end end