I have an application built in Brunch.io that builds the main framework into app.js, but in my assets folder I have various small coffeescript scripts that need to be compiled individually, and not merged together into one.
Is there a way to compile the CS first and then move it to the public folder like everything else in assets?
I notice that there are some plugins for doing this exact thing with Jade templates (so you can have .jade files in your assets folder). Would this need to be a new plugin?
If there's no obvious way to do it, is there at least a way to define the config file so that it can watch a different folder and compile each .coffee file to it's own .js file, without either joining them all together, or needing to specify each file in the config?
Since there are no answers, here's the (slightly hacky) way I ended up doing it:
I installed the After-Brunch plugin and added these two commands to my config file, which get run after every compile by Brunch:
plugins:
afterBrunch: [
'find public/ -type f -name "*.coffee" -delete'
'coffee --compile --output public app/assets/'
]
So this simply explicitly deletes the .coffee files that Brunch moved to public/, and then compiles all the .coffee files in assets/ and moves them to public/. Hacky but it works fine.
This annoyingly feels quite backwards: it would have felt much cleaner (even if only in my head) to compile those .coffee files that were already moved into public/ by Brunch, but Coffee doesn't have an in-place conversion option (i.e. replacing the files) that I know of, and running the converter on the files in public/ first and then deleting all *.coffee files didn't work, because the delete command executed before the compile command was finished... But again, this distinction is probably just in my head -- it's just as efficient doing it this way.
If anyone has a more Brunch-like solution, that would be great.
Related
I am starting a new Theme from scratch and have a file called 'Assets.json' in the root directory.
It maps the LESS file from the 'Assets' directory to a CSS file in the 'Styles' directory - great.
Can anyone point me in the right direction as to how I can make use of this, as it's exactly what I want but can't find any information on how to use it.
Thanks!
The Assets.json file is a way to plug into the default gulp script that is provided with Orchard. This script is able to process .less files (and others) in order to generate minified and non-minified versions of scripts or stylesheets, and bundle your grouped assets. This way you don't have to create your own gulp file for each module, just describe the assets you want to be processed and it will do it automatically.
It will also watch the files you described and re-process them when they have changed. The simplest way to use them is to copy-paste one from the core modules, and place them in your own module or theme. Then just run the main gulp file, or enable its support in Visual Studio. You can run npm install from the root folder for this.
Working with TypeScript and Sublime Text 3 using the T3S package. I'd like my NodeJS project to be structured like so:
/web.js
/views/some-view.js
/controllers/some-controller.js
[...]
/src
/src/web.ts
/src/views/some-view.ts
/src/controllers/some-controller.ts
In other words, I want all my .ts to be under /src and compile to individual .js files under /.
How can I configure T3S to compile my .ts files like this, without explicitly defining each and every .ts file in my sublime-project file?
If I cannot use T3S's build system to accomplish this, then is there a way to disable T3S's build system? Instead I'd make a Ruby filesystem watcher and compile every time a file is changed.
Instead I'd make a Ruby filesystem watcher and compile every time a file is changed.
There are already plenty of grunt plugins for TypeScript. E.g. grunt-ts. The option you need is --outDir : https://github.com/grunt-ts/grunt-ts#compiler-support
With the default version of sails on npm (v.9?) --linker works ok i.e. creates /linker folder. I can copy js, css files to assets/linker/ and they appear in layout.ejs automatically.
I now have sails v0.10 installed both locally and globally. Using Node V0.10.25.
I created a new sails project using:
sails new project_name --linker
but no /linker folder is created.
I had to create /.tmp as it did not exist
I had to create /.tmp/public/linker/ to put /js & /styles
and add them manually into layout.ejs
I renamed Gruntfile.js and my program still works thus Gruntfile does nothing in the program.
Sails v0.10 no longer uses the linker folder--it was just causing confusion. If you have the linker option enabled, then any assets under your assets folder will be copied over to your .tmp/public folder by Grunt when Sails is lifted. The public folder will be created by Grunt as necessary. The grunt-sync task will then keep the folders synced as long as the program is running.
Sails projects are not dependent on Grunt, so renaming the Gruntfile (or removing it completely) won't stop the program from working, but that doesn't mean it's not doing anything when it's there! To see what Grunt is up to, you can lift Sails with sails lift --verbose.
As an add-on to sgress454's answer, the reason a .tmp folder is created is so that files like the ejs and less files can be compiled into formats that your browser will understand. It's similar to the way that when you compile Java, it converts to Java bytecode (just an analogy, definitely not the same process).There doesn't necessarily have to be any .tmp folder when you're not running the server though; this is something Grunt creates and is what the browser reads from. Hope this clarifies things a bit more.
Ok this should be simple, but can't seem to figure this out. I have two projects, ProjectA and ProjectB. ProjectB depends on the old project, ProjectA. Now I want to build ProjectB. And I do not want to change the directory structure for ProjectA now. Problem is, I always used -outputdir bin with ProjectA.
ProjectA looked like this:
ProjectA/
bin/
(*.o, *.hi in proper paths, sometimes also *.p_o and *.p_hi)
Foo/
ModuleX.hs
ModuleA.hs
ModuleB.hs
Now I have a different folder with ProjectB, with its own separate -outputdir. I just need to link to the old project object files (without having ProjectA files recompiled). I realize that I can probably cabalize ProjectA ... but is there no simpler way?
The "simple way" is to use Cabal. Once you've installed Project A, you never need to worry about where the hell it's actually stored ever again; GHC will just find it.
If you don't want to do this, try using the -i switch to GHC to tell what folders to search for your compiled stuff.
http://www.haskell.org/ghc/docs/7.0.1/html/users_guide/separate-compilation.html
I want to watch my jade files and compile them, but it appears it does not work
jade client/jade --watch --out public
When I change client/jade/draft.jade it does not re-compile. I saw a post, saying it does not work with directories? Is it not fixed yet? Is there a workaround or something? Must I watch all files manually?
https://groups.google.com/d/msg/jadejs/p_slRuISjVg/lL_uxgD6uB0J
What you have now says "watch the directory for changes". If you add or remove a file from the directory, it will recompile all the files. However, because it is only watching the directory (which is really just a file itself) and not the files in the directory, changing one of the files will not trigger a compile.
To watch all jade files in client/jade
$ jade --watch client/jade/*.jade --out public
This doesn't truly watch the directory, it just expands the jade command to watch all jade files present when you start, rather than having to type them all out. If you add a file after beginning the watch, then you'll need to restart it.