lib/r5/recipes/materialize.rb in r5-0.4.0.5 vs lib/r5/recipes/materialize.rb in r5-0.5.0.0
- old
+ new
@@ -1,73 +1,26 @@
-add_gem 'materialize-sass'
+add_gem 'materialize-sass', "~> 1.0.0.rc1"
add_gem 'material_icons'
run 'bundle install'
+# system "yarn add jquery moment snackbarjs"
-system "yarn add jquery moment"
+remove_file "#{@project_path}/app/assets/stylesheets/application.css"
-insert_into_file "#{@project_path}/app/assets/stylesheets/application.css",
-before: "\n *= require_tree ." do <<-TXT
-
- *= require materialize
- *= require material_icons
+create_file "#{@project_path}/app/assets/stylesheets/application.scss" do <<-TXT
+@import "materialize/components/color-variables";
+$primary-color: color("grey", "base") !default;
+$secondary-color: color("green", "base") !default;
+$link-color: color("green", "base") !default;
+@import "materialize";
+@import "material_icons";
TXT
end
+
insert_into_file "#{@project_path}/app/assets/javascripts/application.js",
before: "\n//= require_tree ." do <<-TXT
-
- //= require materialize-sprockets
+ \n
+ //= require materialize
+ //= require jquery
TXT
-end
-
-create_file "#{@project_path}/config/webpack/custom.js" do <<-JS
- const webpack = require('webpack')
-
- module.exports = {
- resolve: {
- alias: {
- jquery: 'jquery/src/jquery',
- }
- },
- }
-
- // config/webpack/development.js
- const merge = require('webpack-merge')
- const environment = require('./environment')
- const customConfig = require('./custom')
-
- module.exports = merge(environment.toWebpackConfig(), customConfig)
-JS
-end
-
-insert_into_file "#{@project_path}/app/javascript/packs/application.js",
- after: "console.log('Hello World from Webpacker')" do <<-JS
-
-import jQuery from 'jquery'
-window.jQuery = jQuery
-
-let ready;
-ready = function() {
- // $(".datepicker").datetimepicker({locale: 'cs', format: 'D. M. YYYY'});
-};
-// Fire javascript after turbolinks event
-$(document).on('turbolinks:load', ready);
-JS
-end
-
-insert_into_file "#{@project_path}/config/webpack/environment.js",
- after: "const { environment } = require('@rails/webpacker')" do <<-JS
-
- const webpack = require('webpack')
-
- // Add an additional plugin of your choosing : ProvidePlugin
- environment.plugins.set(
- 'Provide',
- new webpack.ProvidePlugin({
- $: 'jquery',
- jQuery: 'jquery',
- jquery: 'jquery',
- })
- )
-JS
end