From 3c126b3d9616bc07b6d976f8aee7ad662bd8013a Mon Sep 17 00:00:00 2001 From: Gleb Mazovetskiy Date: Fri, 14 Dec 2018 11:30:59 +0000 Subject: [PATCH] Revert relative imports change --- assets/stylesheets/bootstrap/_theme.scss | 4 +-- tasks/converter/less_conversion.rb | 2 -- test/compilation_test.rb | 34 ++++++++++++++++-------- test/dummy_sass_only/Gemfile | 2 +- test/dummy_sass_only/compile.rb | 2 +- test/sass_test.rb | 1 + 6 files changed, 28 insertions(+), 17 deletions(-) diff --git a/assets/stylesheets/bootstrap/_theme.scss b/assets/stylesheets/bootstrap/_theme.scss index 468357d9f1..0ce703acdb 100644 --- a/assets/stylesheets/bootstrap/_theme.scss +++ b/assets/stylesheets/bootstrap/_theme.scss @@ -8,8 +8,8 @@ // Load core variables and mixins // -------------------------------------------------- -@import "bootstrap/variables"; -@import "bootstrap/mixins"; +@import "variables"; +@import "mixins"; // diff --git a/tasks/converter/less_conversion.rb b/tasks/converter/less_conversion.rb index 3e29cc87a2..c6cd7e03de 100644 --- a/tasks/converter/less_conversion.rb +++ b/tasks/converter/less_conversion.rb @@ -124,8 +124,6 @@ def process_stylesheet_assets file = replace_all file, /(\s*)\.navbar-(right|left)\s*\{\s*@extend\s*\.pull-(right|left);\s*/, "\\1.navbar-\\2 {\\1 float: \\2 !important;\\1" when 'tables.less' file = replace_all file, /(@include\s*table-row-variant\()(\w+)/, "\\1'\\2'" - when 'theme.less' - file = replace_all file, /@import "/, '\0bootstrap/' when 'thumbnails.less', 'labels.less', 'badges.less', 'buttons.less' file = extract_nested_rule file, 'a&' when 'glyphicons.less' diff --git a/test/compilation_test.rb b/test/compilation_test.rb index c44a97ac9f..7e8be285d7 100644 --- a/test/compilation_test.rb +++ b/test/compilation_test.rb @@ -3,16 +3,28 @@ require 'sassc' class CompilationTest < Minitest::Test - def test_compilation - path = 'assets/stylesheets' - %w(_bootstrap bootstrap/_theme).each do |file| - FileUtils.rm_rf('.sass-cache', secure: true) - engine = SassC::Engine.new(File.read("#{path}/#{file}.scss"), syntax: :scss, load_paths: [path]) - FileUtils.mkdir_p("tmp/#{File.dirname(file)}") - File.open("tmp/#{file}.css", 'w') { |f| - f.write engine.render - } - assert true # nothing was raised - end + def test_compilation_bootstrap + compile 'bootstrap' + assert true # nothing was raised + end + + def test_compilation_bootstrap_theme + compile 'bootstrap/theme' + assert true # nothing was raised + end + + private + + def compile(file) + path = File.expand_path('../assets/stylesheets', __dir__) + FileUtils.rm_rf('.sass-cache', secure: true) + engine = SassC::Engine.new( + %Q{@import "#{path}/#{file}"}, + syntax: :scss, load_paths: ['.'] + ) + FileUtils.mkdir_p("tmp/#{File.dirname(file)}") + File.open("tmp/#{file}.css", 'w') { |f| + f.write engine.render + } end end diff --git a/test/dummy_sass_only/Gemfile b/test/dummy_sass_only/Gemfile index 784b2761e4..a74bb8f954 100644 --- a/test/dummy_sass_only/Gemfile +++ b/test/dummy_sass_only/Gemfile @@ -1,4 +1,4 @@ source 'https://rubygems.org' -gem 'sassc', '>= 1.12.1' +gem 'sassc', '>= 2.0.0' gem 'bootstrap-sass', path: '../..' diff --git a/test/dummy_sass_only/compile.rb b/test/dummy_sass_only/compile.rb index 6253af119d..50bf3455f7 100644 --- a/test/dummy_sass_only/compile.rb +++ b/test/dummy_sass_only/compile.rb @@ -9,7 +9,7 @@ output = SassC::Engine.new( File.read(File.expand_path('./import_all.scss', __dir__)), - syntax: :scss, load_paths: [load_path] + syntax: :scss, load_paths: ['.', load_path] ).render if out_path diff --git a/test/sass_test.rb b/test/sass_test.rb index 0cb435334e..155603b09f 100644 --- a/test/sass_test.rb +++ b/test/sass_test.rb @@ -3,6 +3,7 @@ require 'test_helper' require 'shellwords' require 'fileutils' +require 'bootstrap-sass' class SassTest < Minitest::Test DUMMY_PATH = 'test/dummy_sass_only'