I am using sbt-concat to create bundles for JS in my application. However, it does not seem to support creating multiple bundles.
In my application, I would like to create a base level js for global use. Then I also want to create a components bundle which will be used on certain pages.
Is this something sbt-concat can do?
No it does not, but you should pretty easily be able to change it into something that does, or just create your own plugin that does.
This is actually the entire codebase that is the sbt-concat plugin (64 lines including whitespace and comments):
https://github.com/mariussoutier/sbt-concat/blob/master/src/main/scala/com/mariussoutier/sbt/ConcatPlugin.scala
Related
I'm using primefaces and primefaces-extensions in my application. For each and every resources like .css and .js files there's also an "ln" and "v" query parameters in the GET request for that resource, like below:
primefaces-extensions.js?ln=primefaces-extension&v=6.1
validation.js?ln=primefaces&v=6.1
As a security concern, since these parameters shows the exact version of the framework I'm using, how can I hide them?
Hiding the 'ln' is kind of useless since with a very small amount of effort, you can get the same information from the javascript files and the source of the page too ('PF() is all over the place)
The 'v' however is a slightly different issue. If you use the non-modified PF source, hiding it is sort of useless too since with very little effort (creating a hash) the possible hackers can download your sources, create a hash and compare the resulting hashes with a dictionary they can easily create of existing PrimeFaces sources and then know which version you use. So the only thing to do here is to modify the source to have it not turn up 'known or comparable' hashes by making some slight modifications (adding whitespace should already help).
But if you really want the version not to be show, you can download the PrimeFaces sources and replace the version info with some ofuscated number and build that custom version. Keep in mind that if you don't make any changes in the sources, the dictionary lookups mentioned above are still working. So it is only some minor inconvenince for hackers.
we are developing mobile app using jquery mobile & phonegap for various customers. Almost all the requirement completed but current requirement is each customer expecting different structure of html. how to make this possible satisfy the requirement?
i can duplicate of all pages and change the structure of html based on customers. But it difficult to maintain all these files i think so
in mvc we having partial view to achieve this, we expecting something same like partial view in html.
Thanks in Advance
Here are couple of approaches I have used in the past in different situations, in decreasing order of my personal preference:
1) Use JSP if your pages are going to live on the server and employ #includes to incorporate fragments of reusable JSP in a master page.
2) Use a template engine to place client-specific HTML fragments. You will be interleaving your business rules in the template's query language.
3) Use Jquery if your pages are packaged in a client app and use $.load() to load fragments of HTML. You will have to ensure that you do this before JQM begins its own life-cycle and fires its init events.
4) Use a Ant build script to do a client specific build using Ant's replace and token match tasks. YMMV with this approach based on the complexity of rules you need to check to create a page. Ant is just one option; any other build tool will provide similar function.
You will probably end up using multiple techniques from above for a complete solution.
I am a front-end guy using Windows for design and html/js/css coding. My work is separate from the back-end guy using .NET. I am also new to Haml/Sass thing as well as Ruby. And definitely not using Rails. After few search, I decided to pick Sublime Text 2 for Sass/Haml support and get rid of my old Notepad++. My first question is:
1. What is the best practice / efficiency to automatically convert whole folder of Haml (primary) and/or Sass to static documents (html/css)?
I have a separate solution for Sass by setting the "watch". I was searching for Haml automatic conversion solution and found few options:
Library for making static websites with HAML/SASS/CSS framework
2. Should I use StaticMatic?
Google search said it is the best. But there seems no update for 2 years
https://github.com/staticmatic/staticmatic
There is also this site (Is it the same?): http://staticmatic.rubyforge.org/how_to_use.html
If I use StaticMatic, I can setup a build system in Sublime Text to run from the Build Menu (http://docs.sublimetext.info/en/latest/file_processing/build_systems.html)
3. OR should I go with all-in-one solution like this (may cost few bucks)? Is there free one?
http://fireapp.handlino.com/
I don't mind to have Sass -watch running separately and another polling mechanism for Haml. I just want to make sure I have the "latest" out there.
Hope to get some advise for my unique situation. Thanks.
The answer is Middleman
http://middlemanapp.com/
It's the replacement for out-dated StaticMatic
HAML:
For automatic conversion from haml to sass you can use this gist: https://gist.github.com/3898955. If you want to automate even more the workflow process, you can use https://github.com/alexnj/SublimeOnSaveBuild sublime package to run the command on file save.
SASS:
For SASS here is the needed setup. https://gist.github.com/3899112.
For automatic conversion on save, the same rules are applied here too, but it's important to include the .sass and .haml extension in SublimeOnSaveBuild.sublime-settings file.
So your file should look like this:
{
"filename_filter": "\\.(css|js|sass|less|scss|jade|haml)$",
"build_on_save": 1
}
You can extend this list at your own wish.
I just came across Twitter Bootstrap today, on SO. I have skimmed through some online tutorials and if my understanding so far is correct, using the TB essentially consists of:
Downloading TB, extracting CSS files etc
Referencing the required CSS, JS files in your HTML doc and using the defined CSS patterns
I want to use Twitter Bootstrap with Symfony2. Given my understanding of how to use TB I thought it would be relatively easy to use it with Symfony, so I was quite suprised to see that there are (actually several) Bundles to use with Symfony.
So my questions are:
Why is a Bundle needed to use Twitter Bootstrap with Symfony2? - will the method I explained above not work (i.e. adding the references directly in a twig template)?
Since there are several Twitter Bootstrap Bundles available (at last count there are 3), which is the easiest to use (it has to be one that is actively supported with recent commits, and not a dead project)
I'm pretty sure these Bundles are great, but they have advantages and drawbacks. You could also use TB without a Bundle directly in your project. That's what I personally do, that way:
git clone TB in web/ (to get latest updates and keep updated)
I directly call bootstrap.less in my twig templates with Assetic and the less filter. That way, I can create my own .less files that #imports TB and use their astonishing mixins for example.
It's really powerful this way. Coupled with yui-compressor, when I use Assetic in no-debug mode, all my js and less files are compiled into one single .css output and one single .js output. And you could benefit from all TB functionalities, in .less, not .css
There are 2 major bundles that provides symfony integration with Twitter Bootstrap:
MopaBootstrapBundle
BcBootstrapBundle
In my opinion:
MopaBootstrapBundle is more complex, provides its own layout structure (of cause you can create your own too) and lot of defined functionality, extra assetic, forms and other integration
BcBootstrapBundle is more simple and much more clear you use your own layout structure and there is a lot of defined functionality, extra assetic, forms and other integration too
dont use any intergtaion bundle also is an option, but you loose integration with forms, assetic, less and so (as #Acyra mentioned in his comment)
I prefer to use BcBootstrapBundle with its extra integration functionality and use my own custom layout structure.
You can use Twitter Boostrap (TB) to only add css to your project. And then, you have a starting point to do something more visual than started from scratch. As you described in the first part.
But, you can also retrieve more interesting stuff from a Bundle which handle template integration with TB. For example:
having a default layout that set some basic column
integration for crud generation
having a basic form element
For example, with symfony 1.4 (I know this post talks about sf2), you have a plugin that can add a new theme to the admin generator to have a nice TB integration instead of the default. I know there is no official admin generator in sf2 but it can be used for CRUD.
One other thing that can be true since symfony 1.0, not all bundles are very well implemented, developped, maintained, tested, documented, etc .. (except thoses from the core team (FOS* Bundle, Doctrine, Propel, etc ..)). So I recommend you to test them all, see if one of them fit your need, otherwise take inspiration to improve them (they are almost all on github) or build your own.
And btw, there are many Bundle ..
UPDATE to Symfony and Bootstrap: Symfony always seems a little behind in the details of their documentation so here's an update on Symfony. Version 2.6 and greater now includes basic integration with Twitter Bootstrap.
http://symfony.com/blog/new-in-symfony-2-6-bootstrap-form-theme
Hopefully this saves someone time and can get it to work as they explain in the Symfony documentation above!
(This is an in-theory question, to scratch a personal itch, so I am not interested in "IMHO thats-not-advisable" answers, because this is just something to fix some little things, not to be installed on your machine etc... ;-)
I have made a couple of custom Gtk widgets that extend the base widgets such as GtkFileChooser and GtkNotebook.
(not much, but its something, as of yesterday I knew nothing about gtk or c, so this is more of an in-theory question - however if its not possible there is not much point in me learning any more gtk2)
However I would like to use these widgets in all my gtk2 apps.
Is it possible to over ride the default widgets system-wise without rebuilding the gtk2 libs from source?
It looks like gtk-modules would be the way to go, but the documentation seems sparse, unless my googling is missing something.
The purpose of this, is that the GtkNotebook does not support multiple rows of tabs, however it is used in Geany, Anjuta, Bluefish and numerous other gtk2 based editors. I can recompile geany and Anjuta, and bluefish to use my widget instead, but I'd prefer to swap it out across the board.
Normally the right solution to reusing widgets between different applications is to create a dynamic library that adds the widgets.
Remember that it's advisable to create real GObject subclasses with a separate GType. Then it's also trivial to add support for say introspection so your widgets can also be used in language bindings etc.