我使用了express-generator命令来生成代码。使用CSS选项作为sass。它添加了sassMiddleware。我将intentionSyntax选项更改为false以获取scss文件而不是sass文件。这是我的代码。
public class MainActivity extends AppCompatActivity {
TwitterLoginButton loginButton;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TwitterConfig config = new TwitterConfig.Builder(this)
.logger(new DefaultLogger(Log.DEBUG))
.twitterAuthConfig(new TwitterAuthConfig(getString(R.string.twitter_consumer_key), getString(R.string.twitter_consumer_secret)))
.debug(true)
.build();
Twitter.initialize(config);
setContentView(R.layout.activity_main);
loginButton = (TwitterLoginButton) findViewById(R.id.login_button);
loginButton.setCallback(new Callback<TwitterSession>() {
@Override
public void success(Result<TwitterSession> result) {
// Do something with result, which provides a TwitterSession for making API calls
TwitterSession session = TwitterCore.getInstance().getSessionManager().getActiveSession();
TwitterAuthToken authToken = session.getAuthToken();
String token = authToken.token;
String secret = authToken.secret;
Intent intent =new Intent(getApplicationContext(), ProfilePage.class);
intent.putExtra("token",token);
startActivity(intent);
}
@Override
public void failure(TwitterException exception) {
// Do something on failure
}
});
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
// Pass the activity result to the login button.
loginButton.onActivityResult(requestCode, resultCode, data);
}
}
生成
$ express --view=hbs --css=sass myapp
我将indentedSyntax更改为false并添加了style.scss文件。但它在加载样式表时出现500错误。