I have some custom script I'd like to run as part of the meteor build script, preferable within a certain step of the build process.
I am reasonable familiar with Maven, Ant and Makefile and Grunt but I can't figure out how to extend the build-process of Meteor.
There's some reference in the Documentation how to create a build-plugin, but I 'just' want to execute some (Java)script during the build. Another so-question mentions using Grunt and run Meteor as part of the build but that sounds a bit backwards as Meteor seems to be a build-system already.
Does Meteor have a build-file hidden somewhere I can extend or modify?
Since Meteor 1.2, there's an option to add your own Build Plugin. Get more info here: https://github.com/meteor/meteor/wiki/Build-Plugins-API
Related
I'm having trouble understanding what I have to do. I work on a Mac and I'm trying to create a 3d portfolio but for some reason, this is difficult. I am trying to figure out why JavaScript is not showing up on Variants. When I type "npm init vite.js/app" this gives me a Framework and then I choose Vanilla and then Select a variant should show up with JavaScript giving me a Package JSON.
Please help.
Vite changed how they display variants.
Just select vanilla if you want to use JavaScript. (not vanilla-ts, as that is the TypeScript version)
Vanilla means "without any modification, so in this case, the first "vanilla" means no library added (react, vue, svelte, etc.), and the second section means without TypeScript.
Remember to cd into that new app's directory and run npm install to install your packages.
I have created some functionality in my Laravel 5.4 project which I think will be useful in other projects. To make it reusable, I've implemented it as a Laravel Package (following instructions here: https://laravel.com/docs/5.4/packages)
The package defines some views, and the views require some javascript, and this javascript requires jQuery.
So how can I set things up so that the scripts get executed when my views are rendered?
The Laravel documentation describes how to use the service provider's publish() method in order to have package scripts copied to the public directory (https://laravel.com/docs/5.4/packages#public-assets). But does this assume the scripts are already compiled / minified? And once they're in the public directory, how should we load them? And how do we handle script dependencies (in my case jQuery)? We don't want it being included more than once.
And where does Laravel Mix come into this?
I think ideally we should to be able to put the javascript source code somewhere in the package:
require('jquery');
// do things with jquery
Then when I run npm run dev (or npm run production) the package javascript is compiled by Mix along with the app javascript and all their dependencies, and the end user's browser just needs to download app.js.
Can anyone suggest how to accomplish this?
Or if I'm going about this all wrong, then can anyone suggest how to do this the 'right' way?
I'm looking at using Semantic UI in my meteor projects. When I try to run: meteor add semantic:ui I get an error from the terminal saying that the package doesn't exists, yet according the Semantic UI GitHub page it should?
semantic:ui is now Depcrecated , like they point on the nooitaf:semantic-ui package Atmosphere README
try with
meteor add semantic:ui-css
Using Deprecated (not a good choose)
meteor add nooitaf:semantic-ui
We're currently working on relaunching the package. We didnt correctly build the LESS theming into meteor's pipeline in the original package so it did not add any particular value over using semantic:ui-css.
The new package should launch in the next couple days and support theming.
Edit: We just launched the new package, won't be going away again :)
https://atmospherejs.com/semantic/ui
I am currently using the accounts-ui-bootstrap-3-blaze package in my Meteor application and I want to modify the login_buttons_dropdown.html file to just add an additional button in the drop down.
How can I patch this package in a 'clean' way?
I already downloaded the package and embedded it manually via the smart.json file, but then I was not able to perform an automatic update via mrt.
Any help would be greatly appreciated.
If it's only for the purposes of a single project then the easiest way would be not to use mrt at all, but put the package source code to the packages directory manually. You will also have to update the .meteor/packages file by yourself. One advantage of this solutions is that any updates to the package source code will be automatically detected by Meteor, so you can take advantage of the hot-code-push feature. This is particularly convenient while in the development process.
If you're planning to re-use your patches in other projects, then I would recommend forking the original repository. It should be quite easy as it will be probably hosted on github. You don't need to publish a package on the atmosphere to be able to install it with mrt command. The only thing you need to do is tell the meteorite to look for this particular package in your custom github repository, so:
"accounts-ui-bootstrap-3-blaze": {
"git": "https://github.com/yourUsername/accounts-ui-bootstrap-3-blaze.git"
}
in your smart.json and you are good to go.
I'm trying to incorporate a Twitter Bootstrap template with Meteor and I'm having trouble understanding how I should include files. For example, let's start with Bootstrap itself, should I install it with Meteor/Meteorite or do it manually with script includes? Same for other javascript plugins (e.g. jquery <- this one is builtin to Meteor right?, lightbox.js.. etc.)
Hope I'm making sense, thanks!
By default meteor already includes jquery.
It's best to look to get your plugins installed via Meteorite. So something like this could get you started
sudo -H npm install -g meteorite
Then in your project directory
mrt add bootstrap-3
For other plugins you can't find on atmosphere add the files into a directory in your project /client/lib. Meteor will automatically reference the files for you, both css and js.
This way they only run on the client side and are loaded first. (such as lightbox.js)
You might have to modify a few files with Meteor, though. In meteor each file's variables are file-scoped. So you can't access them from other files. (meteor basically throws a (function() {..}).call() around the code.
So if you get some kind of issue about a variable being undefined look for the variable and remove the var keyword and remove it so that the variable/method becomes global. With jquery plugins this usually isn't a problem.
Most that have the variable scoping issues are on http://atmosphere.com so you shouldn't run into too many problems.
The most common libraries such as jQuery and Bootstrap (v2.3.0) are provided by the Meteor core (v0.6.6.3). They can be listed using meteor list and included with meteor add.
As referred before, Atmosphere is a collection of unofficial Meteor packages giving an easy way with Meteorite to include even 3rd party solutions to your own project.
Moreover, you should learn the Meteor App structure. Directories created on your project have different preferences in terms of files visibility and loading order. I recommend reading Ritik Malhotra's presentation about the App structure at http://www.slideshare.net/RitikM/building-a-production-ready-meteor-app. There's also a Youtube video about his presentation that can be watched here http://www.youtube.com/watch?v=gfFGjmiKfnA.