Semantic-Org / Semantic-UI-Rails-LESS

This is a gem for Rails with Semantic UI (http://semantic-ui.com) assets inside.
MIT License
123 stars 36 forks source link

Upgrade to less-rails 4 #49

Closed brendon closed 5 years ago

brendon commented 6 years ago

@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 commented 6 years ago

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

kinduff commented 5 years ago

Any plans to merge this?

brendon commented 5 years ago

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

topherfangio commented 5 years ago

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

brendon commented 5 years ago

@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 commented 5 years ago

@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 commented 5 years ago

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

brendon commented 5 years ago

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 commented 5 years ago

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

topherfangio commented 5 years ago

@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 commented 5 years ago

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 commented 5 years ago

@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 commented 5 years ago

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

brendon commented 5 years ago

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

maxd commented 5 years ago

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

brendon commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

@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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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

brendon commented 5 years ago

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 commented 5 years ago

@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 commented 5 years ago

@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: https://github.com/Semantic-Org/Semantic-UI-Rails-LESS/issues/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 commented 5 years ago

@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 commented 5 years ago

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:

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 commented 5 years ago

@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 commented 5 years ago

@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 https://github.com/fomantic/Fomantic-UI/issues/441

brendon commented 5 years ago

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 commented 5 years ago

Let me take a look if there is anything possible I can help with.

Ping me if you can prepare minimal rails app reproducing your problems.

Dne čt 7. 3. 2019 22:09 uživatel Brendon Muir notifications@github.com napsal:

Thanks @hammy2899 https://github.com/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!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Semantic-Org/Semantic-UI-Rails-LESS/pull/49#issuecomment-470695302, or mute the thread https://github.com/notifications/unsubscribe-auth/AAL1kJYGXZY7zYNFyOFlTvWsShQ1Wjcuks5vUYAigaJpZM4WMi18 .

brendon commented 5 years ago

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: https://github.com/cowboyd/less.rb/issues/87