Comments (18)
Simply using the generator didn't work for me for rails.6 API only app.
- After using the generator
- I changed configs from
config/initializers/apitome.rb
as
config.css_override = "/stylesheets/apitome/application.css"
and
config.js_override = "/javascripts/apitome/application.js"
- Manually copied theme file from gem's code to
public/stylesheets/apitome/
That also gave issue post deployments hence at last
a. overridden then layout (i.e copied from gem to application) at "app/views/layouts/apitome.rb" with default css to refer as
<%= stylesheet_link_tag "/stylesheets/apitome/default.css", media: "all" %>
b. changed config file as
config.layout = "apitome"
That worked perfectly post-deployment too. Hope it helps someone too.
from apitome.
That's reasonable.. where would the assets get moved to? /public
? Do people even serve static files usually with rails-api?
from apitome.
And then, if we don't use the asset pipeline, how do people override easily? It might take some playing. Could you not just use sprockets-rails with rails-api and have the same result?
from apitome.
For now, I switched to ActionController::Metal
instead of rails-api, so I can include the needed modules.
I think using the default assets statically with Apitome could be enough (or hosting them separately on a CDN / static server). I didn't need to override the assets.
from apitome.
Right, you may not need to override the assets for now, but it's nice to have the possibility, and is a core aspect of the project. I can play around and see if this is possible.
from apitome.
well, after poking around.. you'd have to copy the files into your own project, since there's no way to serve "public" assets from a gem. so I guess a generator to install the assets is about as good as it gets.
from apitome.
Great! I'll keep an eye on this, let me know if I can be of some help 😃
EDIT: a generator would be totally fine for this specific use case!
from apitome.
let me know how that goes.
from apitome.
I think the generator should copy the files to the following paths:
public/stylesheets/apitome/application.css
public/javascripts/apitome/application.js
in order to work with the following settings:
config.css_override = 'apitome/application.css'
config.js_override = 'apitome/application.js'
from apitome.
you shouldn't have to configure anything.. just install them.
from apitome.
Well, if I do not configure anything, here is what I have in the documentation HTML :
<link href="/stylesheets/apitome/application.css" media="all" rel="stylesheet" />
<script src="/javascripts/apitome/application.js"></script>
I think it's because I don't use Sprockets.
This config works, though:
config.css_override = '/assets/apitome/application.css'
config.js_override = '/assets/apitome/application.js'
from apitome.
Ah, right.. right, so sprockets must take over javascript_include_tag and stylesheet_link_tag methods.. makes sense. so the generator should put them in public/javascripts/apitome etc.?
from apitome.
I just made an update to this, tell me if it works better.
from apitome.
Yes it's working 👍 Thanks!
from apitome.
@jejacks0n I'm using rails-api, currently I copy the files manually. How do I run either rake task or generator to copy assets files from my project?
from apitome.
This does appear to be working but should there be a task to gen those files? I had to generate them with the asset pipeline turned on, than rename them.
from apitome.
https://github.com/modeset/apitome/blob/master/lib/generators/apitome/install/install_generator.rb
from apitome.
@jejacks0n ahh, thanks 😸
from apitome.
Related Issues (20)
- rails generate apitome:install fails - undefined method `assets' HOT 5
- [DOCS] Link to customization examples broken HOT 1
- non-latin characters support HOT 3
- Seeing undefined method 'simulated path' HOT 2
- Does it work with Sprockets 4? HOT 1
- JSON::ParserError in Apitome::Docs#index HOT 16
- Re-routing not working? HOT 1
- code_theme not respecting underscore
- Ruby 3.0.0 HOT 8
- Upgrade jQuery to v3
- Upgrade highlightjs HOT 1
- Translation namespace HOT 5
- Remove rspec_api_documentation from runtime dependency
- New gem version HOT 19
- Missing template apitome/docs/simulate HOT 2
- Left-navigation not highlighting correctly sometimes HOT 7
- There is no configuration option as "parent_controller"? HOT 1
- undefined local variable or method apitome `apitome' after upgrading to 0.2.0 HOT 12
- NameError: uninitialized constant Apitome HOT 8
- Sidebar disappears when placed in layout. HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from apitome.