-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathThorfile
37 lines (30 loc) · 1.06 KB
/
Thorfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
require 'thor/group'
require 'rbconfig'
module Middleman
class Generator < ::Thor::Group
include ::Thor::Actions
source_root File.expand_path(File.dirname(__FILE__))
def host_info
arch = !(RbConfig::CONFIG['host_cpu'] =~ /arm/).nil? ? 'arm64' : 'x64'
if !(RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/).nil?
"windows-#{arch}.exe"
elsif !(RbConfig::CONFIG['host_os'] =~ /darwin|mac os/).nil?
"macos-#{arch}"
else
"linux-#{arch}"
end
end
def copy_default_files
directory 'template', '.', exclude_pattern: /\.DS_Store$/
twc_version = '3.3.6'
bin = "tailwindcss-#{host_info}"
%x(curl -sLO https://github.com/tailwindlabs/tailwindcss/releases/download/v#{twc_version}/#{bin})
%x(chmod +x #{bin})
%x(mv #{bin} tailwindcss)
%x(./tailwindcss init)
lines = File.readlines('tailwind.config.js')
lines[2] = " content: ['./source/**/*.{html,js,haml}']," << $/
File.open('tailwind.config.js', 'w') { |f| f.write(lines.join) }
end
end
end