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

Upgrade to less-rails 4 #49

Merged
merged 10 commits into from
Nov 1, 2018

Conversation

brendon
Copy link
Collaborator

@brendon brendon commented Aug 25, 2018

@simi, this is currently pinned to 4.0.0.rc1 but I can fix that up before you merge this. I just wanted to get the travis matrix to run to confirm it tests out good. Locally it's working well. There was a lot of redundant stuff around dependencies there so I've stripped it all down to make things as lean as possible.

Closes #39
Closes #40
Closes #38
Closes #32

@brendon
Copy link
Collaborator Author

brendon commented Aug 26, 2018

@simi, it's green, let's release 4.0.0 and a new version of this gem and be done with it :)

@kinduff
Copy link

kinduff commented Sep 21, 2018

Any plans to merge this?

@brendon
Copy link
Collaborator Author

brendon commented Sep 21, 2018

Hopefully! :) @simi, can you action releasing 4.0.0 of less-rails, and then merge this and release?

@topherfangio
Copy link

@maxd Any chance this could be merged? :-) We really need it!

@brendon
Copy link
Collaborator Author

brendon commented Oct 29, 2018

@simi, perhaps you could delegate management of at least less-rails to me if you're struggling to find time to do the maintenance? I'm a maintainer for acts_as_list and ranked-model. I'm also happy to help maintain this gem.

@topherfangio
Copy link

@brendon I'm trying to get your forked version working on my machine and I'm getting the following error. Any thoughts?

couldn't find file 'semantic_ui/definitions/modules/accordion.less' with type 'text/css'

What's funny is I have verified that the file exists in the spot it's looking.

@topherfangio
Copy link

Never mind me, I forgot that I ran rails generate semantic_ui:install before the upgrade, so it had old files 🤦‍♂️

@brendon
Copy link
Collaborator Author

brendon commented Oct 29, 2018

All good :) For others that come across this. You need to remove the .less from the require statements. If you generate with my fork those are already removed.

@simi
Copy link

simi commented Oct 31, 2018

🎉 https://rubygems.org/gems/less-rails/versions/4.0.0

@topherfangio
Copy link

@brendon @simi I realize this is not quite related to this PR but not sure a better place to ask: what is the best way to add JS components in the Rails version?

In our other project, we had a semantic.json file where we could add new components to the list and they would be built. Does this have something similar or do we just need to drop our custom stuff in the assets/javascripts folder and make sure it loads after Semantic (since we're making custom Semantic modules)?

Thanks!

@brendon
Copy link
Collaborator Author

brendon commented Oct 31, 2018

Hi @tophetfangio, I’m afraid I don’t know. Could you put them under vendor/assets/semantic-ui where all the other modifications of existing modules goes?

Also yay! Thanks @simi I’ll update this PR to point at 4.0.0 and this can be merged too.

@brendon
Copy link
Collaborator Author

brendon commented Oct 31, 2018

@simi, while you're on a roll can you accept this PR? I've updated the dependency on less-rails to 4.0.0. Then we can officially put this whole saga behind us!

@simi
Copy link

simi commented Oct 31, 2018

@brendon I can't merge pull requests in this repository :/

@brendon
Copy link
Collaborator Author

brendon commented Oct 31, 2018

Oh lol! :) @maxd, could you please merge this? It also looks like we're behind the latest Semantic-UI version too.

@maxd
Copy link
Contributor

maxd commented Nov 1, 2018

@brendon I don't have time to continue development of this repository now. So, I have added you to collaborators.

@brendon
Copy link
Collaborator Author

brendon commented Nov 1, 2018

Thanks @maxd. Could you make me a gem maintainer too so I can release the gems. Could you let me know your workflow for doing that also?

@brendon brendon merged commit e3969a2 into Semantic-Org:master Nov 1, 2018
@brendon
Copy link
Collaborator Author

brendon commented Nov 1, 2018

I've merged this and will release a new gem version for all those waiting. I guess then we need to update to the latest SemanticUI.

@maxd
Copy link
Contributor

maxd commented Nov 1, 2018

@brendon Could you please provide your e-mail registered on RubyGems? It's required to add you to owners of this gem.

The workflow to release new version is very easy. Just run rake update:version[<tag with version from official SemanticUI repository>] (details here). Then just review changes and commit them to run Travis CI.

@brendon
Copy link
Collaborator Author

brendon commented Nov 1, 2018

Thanks @maxd. It's brendon@spike.net.nz.

Thanks also for the info. I assume you run rake release at the end of that to release the gem or is that part of the script?

@maxd
Copy link
Contributor

maxd commented Nov 1, 2018

No, I just run the following commands to build and push updated version of gem:

gem build less-rails-semantic_ui.gemspec
gem push less-rails-semantic_ui-x.x.x.x.gem

@brendon
Copy link
Collaborator Author

brendon commented Nov 1, 2018

Cheers, thanks for that. I'll look to do a release soon.

@brendon
Copy link
Collaborator Author

brendon commented Nov 1, 2018

Hi @maxd, I've come up with a problem trying to include the latest SemanticUI. I've created an issue here: #50. I'm happy to look into it further myself but just wanted to quickly check with you that there's no easy explanation that you already know of for the issue. I tried 2.3.3 also with the same result.

@daveharris
Copy link

@brendon So if the upgrade to less-rails v4 is complete and this PR has been merged into master, is it ready to be released? Or is your moment above saying you are having issues preventing this?

Sorry if I'm asking in the wrong place but there are so many issues related to the same thing.

Thank you so much for your work in getting the PR merged, it seems like a very tricky environment to develop in with so many script upstream dependencies.

@brendon
Copy link
Collaborator Author

brendon commented Mar 7, 2019

@daveharris, yep it's a nightmare! Unfortunately I was unable to bring in or release the latest version of semantic-ui :( The reason is outlined here: #53

Basically there are just too many abandoned dependencies, the worst being less.rb which makes compiling the latest Semantic-UI templates a no-go. I think the key would be to get a modern javascript based less implementation working with this library instead so that we could compile without problems. There are already workarounds happening in the latest current version of Semantic-UI-Rails-LESS to cope with less.rb being trapped at version 1.7.

Basically in the end I implemented webpacker with my Rails 4.2 app and brought semantic-ui in that way. It was still pretty complicated but easier.

@daveharris
Copy link

@brendon well you gave it your best bet! I've been trying to decide what the best solution to all this is. The "only" reason why I wanted it in less was so that I could customise the colours etc like @blue: #247ba0;.

I think I might actually step outside rails entirely, which means I can remove less and therubyracer which will save a bunch of memory. I was thinking of having the standard SemanticUI sitting alongside the rails app, and using grunt to build and copy it into the rails app, given that modifying the build is something I very rarely do. It will also mean that I don't have the huge performance hit in development from #31.

I don't suppose you wrote a blog post about implementing it with webpacker did you?!

@brendon
Copy link
Collaborator Author

brendon commented Mar 7, 2019

Hehe, I wish I did, but I did use a lot of other peoples blog posts to get it there:

Essentially this was the custom.js:

const path = require('path')
const webpack = require('webpack')

module.exports = {
  resolve: {
    alias: {
      '../../theme.config$': path.join(__dirname, '../../app/semantic_ui/theme.config')
    }
  },
  plugins: [
  	new webpack.ProvidePlugin({
	    $: 'jquery',
	    jQuery: 'jquery'
	  })
  ]
}

I made a app/semantic_ui directory then within that you have:

  • Folders for each collections, elements, globals, modules, views and within those the .variables and .overrides files.
  • theme.config copied and modified as per the blog posts.
  • semantic.less that loads in all the components you want. I commented out the ones I didn't want. I can't remember if the paths needed rewriting but here is a sample line: & { @import "~semantic-ui-less/definitions/elements/image"; }
  • semantic.js that imports the particular module JS that you need. Here's a sample line: import 'semantic-ui-less/definitions/behaviors/api';

I hope that helps. It is more convenient to have it all part of the Webpack pipeline but one can feel the extra compile time unfortunately.

@brendon
Copy link
Collaborator Author

brendon commented Mar 7, 2019

@hammy2899 I just wondered if you'd be interested in this conversation too? How does this all fit in with your future plans for modernising the build pipeline for Formantic-UI?

@y0hami
Copy link
Member

y0hami commented Mar 7, 2019

@brendon We are discussing and researching possibly moving to SASS for v3 instead of LESS. For the build process we are also still doing research but we are trying to make it a simple step instead of having the include lots of files etc in your project. You can read more about the build process for theming here fomantic/Fomantic-UI#441

@brendon
Copy link
Collaborator Author

brendon commented Mar 7, 2019

Thanks @hammy2899 :) A switch to SASS would make things a lot easier! That's certainly an interesting issue thread. I also wanted to say a quick thank you to you and your collaborators on the Formantic-UI effort. It's great to see this library getting some love again!

@simi
Copy link

simi commented Mar 7, 2019 via email

@brendon
Copy link
Collaborator Author

brendon commented Mar 7, 2019

Thanks @simi, I'm afraid it's more than that. Semantic-UI introduced a requirement for Less 3.5: https://github.com/Semantic-Org/Semantic-UI/blob/master/RELEASE-NOTES.md#version-241---oct-13-2018

So in order to ever get this working again the following libraries would need to be updated to support Less 3.5:

As you can see it's a long line of abandoned projects.

See: cowboyd/less.rb#87

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
7 participants