Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat/tailwind 2 compat build #356

Merged
merged 1 commit into from
Jun 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Features:

Fixes:
- Explicitly install project specified node version in CircleCI build [#352](https://github.com/platanus/potassium/pull/352)
- Fixes `tailwindCSS@^2` incompatibility with `postcss@^7` [#356](https://github.com/platanus/potassium/pull/356)
- Update marcel gem (shrine's mime type analyzer) to avoid mimemagic dependency [#357](https://github.com/platanus/potassium/pull/357)

## 6.2.0
Expand Down
7 changes: 6 additions & 1 deletion lib/potassium/recipes/front_end.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ def add_responsive_meta_tag
end

def setup_tailwind
run 'bin/yarn add tailwindcss'
run "bin/yarn add tailwindcss@#{Potassium::TAILWINDCSS}"
specify_autoprefixer_postcss_compatibility_versions
setup_client_css
remove_server_css_requires
setup_tailwind_requirements
Expand Down Expand Up @@ -147,6 +148,10 @@ def apollo_loading
JS
end

def specify_autoprefixer_postcss_compatibility_versions
run 'bin/yarn -D add postcss@^7 autoprefixer@^9'
end

def setup_client_css
application_css = 'app/javascript/css/application.css'
create_file application_css, "", force: true
Expand Down
1 change: 1 addition & 0 deletions lib/potassium/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ module Potassium
POSTGRES_VERSION = "11.3"
MYSQL_VERSION = "5.7"
NODE_VERSION = "12"
TAILWINDCSS = "npm:@tailwindcss/postcss7-compat"
end
14 changes: 14 additions & 0 deletions spec/features/front_end_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@
expect(File).not_to exist(application_css_path)
end

def expect_to_have_tailwind_compatibility_build
expect(node_modules_file).to include("\"tailwindcss\": \"npm:@tailwindcss/postcss7-compat\"")
expect(node_modules_file).to include("\"autoprefixer\": \"^9\"")
expect(node_modules_file).to include("\"postcss\": \"^7\"")
end

context "with vue" do
before(:all) do
remove_project_directory
Expand Down Expand Up @@ -55,6 +61,10 @@
expect(tailwind_config_file).to include('module.exports')
end

it 'includes correct packages for tailwind, postcss and autoprefixer compatibility build' do
expect_to_have_tailwind_compatibility_build
end

context "with graphql" do
before(:all) do
remove_project_directory
Expand Down Expand Up @@ -84,5 +94,9 @@
it "creates application_js_file for tailwind without vue" do
expect(application_js_file).to include("import '../css/application.css';")
end

it 'includes correct packages for tailwind, postcss and autoprefixer compatibility build' do
expect_to_have_tailwind_compatibility_build
end
end
end