Using storybook with react-rails? - react-rails

I am trying to use storybook with react-rails
If I install the reactjs project inside app/assets/javascripts/components I will have so many other files not related directly to the project ( stories and node_modules.. etc)
Whats is the recommended way to use storybook with a react-rails ?
Also, creating a reactjs inside app/assets/javascripts/components will make it overhead, considering that I am already using react-rails
What's the advice here?

Related

How to build sass files with django

I'm completly new with Django and python (and alone as tech in my company, not able to ask help to previous dev). I have to maintain an existing app written in django still developing new services fully written in node, which is my most important task (and my skills). I have a problem that i have fixed some bugs in UX, fixing CSS mostly. And I don't understand how to build sass.
In manage.py, when i ask the list of commands the only things which is related to my problem is "collectstatic" which seems to not build but just collect static files (good naming so) in one folder. And obviously, it doesn't resolve my problem.
Any suggestion ? I'm lost in this big new thing. Many love on every body who can help me. Do you know if there is an integrated tool ? Do i need to use an external compiler which is just not documented ?
Django got nothing to do with compiling assets, you compile it your way in node using your favorite bundler like gulp or webpack and then introduce the final path to django. but people stumbled upon this and created bunch of helper libs, checkout django_webpack.
In case you felt overwhelm then save learning curve time and do like I said earlier, bundle it on your flavor and create a management command in Django that you can run the bundler from python context.

does django have lots of clash if not isolated

I'm very new to django and web dev in general. I'm following tutorial https://www.youtube.com/watch?v=n-FTlQ7Djqc&index=1&list=PL4cUxeGkcC9ib4HsrXEYpQnTOTZE1x0uc create a blog by 'The Net Ninja'. His django version is 1.x but I'm using 2.1
I have completed it and have successfully emulate it on my own by following along.
But I wanted to make another on my own.
After I created it the files in my static files(the pictures for background) are clashing with my previous project.
Now background photo of my new project shows in previous project (both projects have static files in similar named folder )
So am I supposed to use virtualenv and is this kind of clash normal??? please help
It depends on what you mean with "clash". If you configure both installations to point to the same static files location, then, yes, you might have some "clashes". You can just make them point to separate folders.
As for virtual environments, it's generally a good idea to have a separate one for each project. This way you can isolate your dependencies better. This is especially important if you're going to run different versions of Django concurrently where some third party apps might not work on all versions.

Is there some way I can get ember-cli to build only the styles?

I'm creating a bunch of themes by passing variables into ember-cli. Is there some reasonable way for me to configure Ember to only do the CSS build?
Is there a reason you need ember-cli if you are just building out the css? Couldn't you build out the themes with Sass or Less or PostCSS? Perhaps I'm not fully understanding the entire use case here but if you're just trying to compile styles, one of these tools may be of better use. If you must stay inside Ember, you can leverage addons like ember-cli-sass to make this process much easier.

django-pipeline django-compressor django-require, to combine javascript files (requirejs)

I have many javascripts files (using requirejs) which I want to combine.
There are many asset manangements apps and it is hard to know which tool is right one for me.
For instance, I'm not sure how I could use django-pipeline to combine javascripts files since
I have require(['some-dependency'], function(dependency) {
instead of <script type="text/javascript" src="somefile.js"></script>
I suspect that django-require is able to optimize requirejs-using javascripts since django-require states that it optimizes using requriejs.
But it's hard to know how to do it from their doc.
I had similar problems with combining different Django apps for more complex frontend tasks. I ended up using Grunt and Bower along side Django and don't regret that at all.
I actually gave a talk on this a week ago at Django Stockholm meet up, the slides are available here to get you started:
https://volumental-public-downloads.s3.amazonaws.com/django_and_a_modern_frontend_django_meetup_2014.pdf
To use Grunt to run your requirejs build you would use the Grunt plugin: https://www.npmjs.org/package/grunt-contrib-requirejs
I found this to be a good resource to set everything up for requirejs and grunt:
Working project structure that uses grunt.js to combine JavaScript files using RequireJS?
Best of luck!

Easier way to setup Django projects?

I've just started using Django and one thing I find that I'm doing is starting a lot of new projects. I'm finding this process to be pretty tedious every time, even using manage.py startproject * I'm constantly changing settings in settings.py like media_root and template paths. Just a little background, I come from PHP and CodeIgniter. I never used a stock CI directory. I modified it to meet my needs for a new project. When I needed a new project, I would just copy that directory. manage.py seems to generate the files on the fly so this approach doesn't seem that possible. Does anyone else have any advice on this?
Lincoln loop has some best practices, they suggest importing settings from a different file. http://lincolnloop.com/django-best-practices/projects/modules/settings.html
Also checkout pip requirements, you might be able to use this to install the settings module from an external source like a git repo.
I'm using Paver to automate my Django project setup.
I have a Bitbucket repository with my own bootstrap setup. Eventually I'll make this generic, but for now it might give you some example code
Sounds like you're starting new projects very often. I assume that's because you're learning. Sure, if there's a custom settings.py that will save you some typing as you generate your learning projects, create it and use it. You could make your template the whole project directory, but since you're unlikely to have a lot of project-level boilerplate outside of settings.py, just focus on that one file. The settings file is the essence of the project.
Django development is all about apps. As you learn more, apps will start to become your focus. My advice would be not to pour too much energy into making an efficient assembly line for project creation.
Also, please learn and use use version control. For bonus points, also learn and use virtualenv :)