forked from sass/libsass
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsassc++.cpp
More file actions
37 lines (32 loc) · 682 Bytes
/
Copy pathsassc++.cpp
File metadata and controls
37 lines (32 loc) · 682 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <cstdlib>
#include <string>
#include <iostream>
#include "context.hpp"
#include "error_handling.hpp"
using namespace std;
int main(int argc, char** argv)
{
if (argc < 2) {
cout << "Please specify a file on the command line." << endl;
return 1;
}
string file_name(argv[1]);
try {
Sass::Context ctx(
Sass::Context::Data().entry_point(file_name)
.output_style(Sass::FORMATTED)
);
char* result = ctx.compile_file();
if (result) {
cout << result;
free(result);
}
}
catch (Sass::Error& e) {
cout << e.path << ":" << e.line << ": " << e.message << endl;
}
catch (string& msg) {
cout << msg << endl;
}
return 0;
}