Last active
November 13, 2019 22:02
-
-
Save kgrz/5caf63f827e5a6181597cefae484a515 to your computer and use it in GitHub Desktop.
Sample working code for http://stackoverflow.com/questions/36354581/how-to-use-rails-autoprefixer-in-sinatra-app. Refer to the file folder_structure.txt for reference
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'sinatra' | |
require 'sprockets' | |
require 'autoprefixer-rails' | |
assets = Sprockets::Environment.new do |env| | |
# append assets paths | |
env.append_path "assets" | |
end | |
AutoprefixerRails.install(assets) | |
get '/assets/*' do | |
env["PATH_INFO"].sub!("/assets", "") | |
assets.call(env) | |
end | |
get '/' do | |
erb :index | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
├── app.rb | |
├── assets | |
│ ├── some_more_styles.css | |
│ └── styles.css | |
└── views | |
└── index.erb |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title></title> | |
<link rel="stylesheet" href="/assets/styles.css" type="text/css" media="screen" title="no title" charset="utf-8"> | |
</head> | |
<body> | |
<body> | |
<p class='paragraph'> | |
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod | |
tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At | |
vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, | |
no sea takimata sanctus est Lorem ipsum dolor sit amet. | |
</p> | |
</body> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.paragraph { | |
font-size: 36px; | |
color: red; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//= require ./some_more_styles.css | |
//= require_self | |
.paragraph { | |
font-feature-settings: kern 1; | |
background: gray; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment