Logo: Relish

  1. Sign in

Project: Middleman-more

Relative Assets

In order easily switch between relative and absolute paths

Scenarios
Previewing css with the feature disabled
Given
"relative_assets" feature is "disabled"
And
the Server is running at "relative-assets-app"
When
I go to "/stylesheets/relative_assets.css"
Then
I should not see "url('../"
And
I should see "/images/blank.gif')"
Building css with the feature disabled
Given
a fixture app "relative-assets-app"
And
a file named "config.rb" with:
Given
a successfully built app at "relative-assets-app"
When
I cd to "build"
Then
the file "stylesheets/relative_assets.css" should contain "url('/images/blank.gif')"
Rendering html with the feature disabled
Given
"relative_assets" feature is "disabled"
And
the Server is running at "relative-assets-app"
When
I go to "/relative_image.html"
Then
I should see "/images/blank.gif"
Rendering css with the feature enabled
Given
"relative_assets" feature is "enabled"
And
the Server is running at "relative-assets-app"
When
I go to "/stylesheets/relative_assets.css"
Then
I should see "url('../images/blank.gif"
Building css with the feature enabled
Given
a fixture app "relative-assets-app"
And
a file named "config.rb" with:
activate :relative_assets
Given
a successfully built app at "relative-assets-app"
When
I cd to "build"
Then
the file "stylesheets/relative_assets.css" should contain "url('../images/blank.gif')"
Rendering html with the feature enabled
Given
"relative_assets" feature is "enabled"
And
the Server is running at "relative-assets-app"
When
I go to "/relative_image.html"
Then
I should not see "/images/blank.gif"
And
I should see "images/blank.gif"
Rendering css with a custom images_dir
Given
"relative_assets" feature is "enabled"
And
"images_dir" is set to "img"
And
the Server is running at "relative-assets-app"
When
I go to "/stylesheets/relative_assets.css"
Then
I should see "url('../img/blank.gif')"
Building css with a custom images_dir
Given
a fixture app "relative-assets-app"
And
a file named "config.rb" with:
set :images_dir, "img"
activate :relative_assets
Given
a successfully built app at "relative-assets-app"
When
I cd to "build"
Then
the file "stylesheets/relative_assets.css" should contain "url('../img/blank.gif')"
Rendering html with a custom images_dir
Given
"relative_assets" feature is "enabled"
And
"images_dir" is set to "img"
And
the Server is running at "relative-assets-app"
When
I go to "/relative_image.html"
Then
I should not see "/images/blank.gif"
Then
I should not see "/img/blank.gif"
And
I should see "img/blank.gif"
Rendering scss with the feature enabled
Given
"relative_assets" feature is "enabled"
And
the Server is running at "fonts-app"
When
I go to "/stylesheets/fonts.css"
Then
I should see "url('../fonts/StMarie-Thin.otf"

Last published over 6 years ago by middleman.